cardHolder.vue 34 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304
  1. <template>
  2. <view class="content">
  3. <u-navbar title="电子名片" placeholder bgColor="#112253" titleStyle="color:#fff">
  4. <view class="u-nav-slot relative" slot="left">
  5. <u-icon name="bell" size="26" @click="toNotice" color="#fff"></u-icon>
  6. <u-badge :isDot="unread>0?true:false" type="error" class="point"></u-badge>
  7. </view>
  8. </u-navbar>
  9. <view class="content1 flex-row-center">
  10. <view class="search flex flex-between" @click="search">
  11. <view class="left flex">
  12. <uni-icons type="search" size="24" color="#9199af"></uni-icons>
  13. <text class="search-val"> {{searchVal?searchVal:'搜索名片'}}</text>
  14. <uni-icons type="closeempty" size="24" @click.native.stop="delSearchVal"
  15. v-if="searchVal"></uni-icons>
  16. </view>
  17. <view class="right">
  18. <image style='width:32rpx;height:32rpx;' v-if="searchVal" @click.native.stop="delSearchVal" src="../../static/imgs/card/searchdel.png" mode="widthFix" ></image>
  19. <uni-icons type="mic" size="24" @click.native.stop="micOpen" color="#9199af"></uni-icons>
  20. </view>
  21. </view>
  22. <view class="col flex">
  23. <uni-icons type="scan" size="30" @click="scan" color="#fff"></uni-icons>
  24. </view>
  25. </view>
  26. <view class="content2">
  27. <view class="all-type flex" @click="selectType">
  28. <text>{{typeName?typeName:'全部分类'}}</text>
  29. <uni-icons type="bottom" size="18" color="#fff"></uni-icons>
  30. </view>
  31. </view>
  32. <view class="content3">
  33. <mescroll-body v-if='cardHolderList' :up="upOption" ref="mescrollRef" @init="mescrollInit" @up="upCallback"
  34. @down="downCallback">
  35. <view v-for='(item,index) in cardHolderList' @longpress="longpress" class="item flex">
  36. <!-- <view class="card-list-item" style="background:red"> -->
  37. <view class="card-list-item"
  38. :style="'background:url('+item.currentBackground+');background-size:100% 100%'">
  39. <view class="card-content style1" v-if="item.cuttentTemplate==1">
  40. <view class="left">
  41. <u--image :showLoading="true" :src="item.headSculpture" width="66px" height="66px"
  42. shape="circle"></u--image>
  43. </view>
  44. <view class="right">
  45. <view class="row1">
  46. <text class="name">{{item.name}}</text>
  47. <text class="post">{{item.post}}</text>
  48. </view>
  49. <view class="row2">
  50. {{item.companyName}}
  51. </view>
  52. <view class="row3 flex" @click="">
  53. <u--image :showLoading="true" src="/static/imgs/card/address1.png" width="13px" height="16px"
  54. ></u--image>
  55. <view class='icon-text'>{{ item.province }}{{ item.city }}{{ item.area }}</view>
  56. </view>
  57. <view class="row4 flex">
  58. <u--image :showLoading="true" src="/static/imgs/card/phone1.png" width="12px" height="13px"
  59. ></u--image><view class='icon-text'>{{ item.phone }}</view>
  60. </view>
  61. <view @click='remarkEdit(item)' class="row2 flex" style="color: #808080">
  62. <u--image :showLoading="true" src="/static/imgs/card/remark1.png" width="10px" height="12px"
  63. ></u--image>
  64. <view class='icon-text'>{{item.remark?item.remark:'单击添加备注'}}</view>
  65. </view>
  66. </view>
  67. <u-checkbox-group v-if='islongPress' placement="column"
  68. @change="checkboxChange($event,index)">
  69. <u-checkbox iconColor='#4977FC' activeColor="#fff" :name='index+1' :checked='item.checked'
  70. :customStyle="{marginBottom: '8px'}">
  71. </u-checkbox>
  72. </u-checkbox-group>
  73. </view>
  74. <view class="card-content style1 flex-between" v-if="item.cuttentTemplate==2">
  75. <view class="right">
  76. <view class="row1">
  77. <text class="name">{{item.name}}</text>
  78. <text class="post">{{item.post}}</text>
  79. </view>
  80. <view class="row2">
  81. {{item.companyName}}
  82. </view>
  83. <view class="row3 flex">
  84. <u--image :showLoading="true" src="/static/imgs/card/address3.png" width="13px" height="16px"
  85. ></u--image>
  86. <view class='icon-text'>{{ item.province }}{{ item.city }}{{ item.area }}</view>
  87. </view>
  88. <view class="row4 flex">
  89. <u--image :showLoading="true" src="/static/imgs/card/phone3.png" width="12px" height="13px"
  90. ></u--image><view class='icon-text'>{{ item.phone }}</view>
  91. </view>
  92. <view @click='remarkEdit(item)' class="row2 flex" style="color: #808080">
  93. <u--image :showLoading="true" src="/static/imgs/card/remark3.png" width="10px" height="12px"
  94. ></u--image>
  95. <view class='icon-text'>{{item.remark?item.remark:'单击添加备注'}}</view>
  96. </view>
  97. </view>
  98. <view class="left">
  99. <u--image :showLoading="true" :src="item.headSculpture" width="66px" height="66px"
  100. shape="circle" v-if="item.headSculpture"></u--image>
  101. <u--image :showLoading="true" src="/./../static/imgs/card/defaulthead.png" width="66px"
  102. height="66px" shape="circle" v-else></u--image>
  103. </view>
  104. <u-checkbox-group v-if='islongPress' placement="column"
  105. @change="checkboxChange($event,index)">
  106. <u-checkbox iconColor='#4977FC' activeColor="#fff" :name='index+1' :checked='item.checked'
  107. :customStyle="{marginBottom: '8px'}">
  108. </u-checkbox>
  109. </u-checkbox-group>
  110. </view>
  111. <view class="card-content style2" v-if="item.cuttentTemplate==3">
  112. <view class="top">
  113. <u--image :showLoading="true" :src="item.headSculpture" width="66px" height="66px"
  114. shape="circle" v-if="item.headSculpture"></u--image>
  115. <u--image :showLoading="true" src="/./../static/imgs/card/defaulthead.png" width="66px"
  116. height="66px" shape="circle" v-else></u--image>
  117. </view>
  118. <view class="bottom flex">
  119. <view class="left">
  120. <view class="row1">
  121. <text class="name">{{item.name}}</text>
  122. <text class="post">{{item.post}}</text>
  123. </view>
  124. <view class="row2">
  125. {{item.companyName}}
  126. </view>
  127. </view>
  128. <view class="right">
  129. <view class="row1 flex">
  130. <u--image :showLoading="true" src="/static/imgs/card/address1.png" width="13px" height="16px"
  131. ></u--image><view class='icon-text'>{{ item.province }}{{ item.city }}{{ item.area }}</view>
  132. </view>
  133. <view class="row2 flex">
  134. <u--image :showLoading="true" src="/static/imgs/card/phone1.png" width="12px" height="13px"
  135. ></u--image><view class='icon-text'>{{ item.phone }}</view>
  136. </view>
  137. <view @click='remarkEdit(item)' class="row2 flex" style="color: #808080">
  138. <u--image :showLoading="true" src="/static/imgs/card/remark1.png" width="10px" height="12px"
  139. ></u--image>
  140. <view class='icon-text'>{{item.remark?item.remark:'单击添加备注'}}</view>
  141. </view>
  142. </view>
  143. </view>
  144. <u-checkbox-group v-if='islongPress' placement="column"
  145. @change="checkboxChange($event,index)">
  146. <u-checkbox iconColor='#4977FC' activeColor="#fff" :name='index+1' :checked='item.checked'
  147. :customStyle="{marginBottom: '8px'}">
  148. </u-checkbox>
  149. </u-checkbox-group>
  150. </view>
  151. <view class="card-content style2" v-if="item.cuttentTemplate==4">
  152. <view class="top">
  153. <view class="row1">
  154. <text class="name">{{item.name}}</text>
  155. <text class="post">{{item.post}}</text>
  156. </view>
  157. <view class="row2">
  158. {{item.companyName}}
  159. </view>
  160. </view>
  161. <view class="bottom flex">
  162. <view class="left">
  163. <u--image :showLoading="true" :src="item.headSculpture" width="66px" height="66px"
  164. shape="circle" v-if="item.headSculpture"></u--image>
  165. <u--image :showLoading="true" src="/./../static/imgs/card/defaulthead.png"
  166. width="66px" height="66px" shape="circle" v-else></u--image>
  167. </view>
  168. <view class="right">
  169. <view class="row1 flex">
  170. <u--image :showLoading="true" src="/static/imgs/card/address2.png" width="13px" height="16px"
  171. ></u--image><view class='icon-text'>{{ item.province }}{{ item.city }}{{ item.area }}</view>
  172. </view>
  173. <view class="row2 flex">
  174. <u--image :showLoading="true" src="/static/imgs/card/phone2.png" width="12px" height="13px"
  175. ></u--image><view class='icon-text'>{{ item.phone }}</view>
  176. </view>
  177. <view @click='remarkEdit(item)' class="row2 flex" style="color: #808080">
  178. <u--image :showLoading="true" src="/static/imgs/card/remark2.png" width="10px" height="12px" ></u--image>
  179. <view :style='item.remark?"color:#000;":"color:#808080;"' class='icon-text'>{{item.remark?item.remark:'单击添加备注'}}</view>
  180. </view>
  181. </view>
  182. </view>
  183. <u-checkbox-group v-if='islongPress' placement="column"
  184. @change="checkboxChange($event,index)">
  185. <u-checkbox iconColor='#4977FC' activeColor="#fff" :name='index+1' :checked='item.checked'
  186. :customStyle="{marginBottom: '8px'}">
  187. </u-checkbox>
  188. </u-checkbox-group>
  189. </view>
  190. <view class="car-bottom flex">
  191. <view class="left">
  192. <image src="../../static/imgs/card/home.png" mode="widthFix" style="width: 32rpx;"
  193. @click="toHome(item)"></image>
  194. <text @click='switchType(item)'
  195. style="color: #fff;">{{item.classify?item.classifyName:'默'}}</text>
  196. <image src="../../static/imgs/card/share.png" mode="widthFix" style="width: 35rpx;"
  197. @click="share(item)"></image>
  198. </view>
  199. <view class="right">
  200. </view>
  201. </view>
  202. </view>
  203. <!-- <view class="left">
  204. <view class="top flex-row-center">
  205. <image :src="item.headSculpture" mode="widthFix" class="img"></image>
  206. </view>
  207. <view class="bottom flex flex-evenly">
  208. <uni-icons @click="toHome(item)" type="home" size="20"></uni-icons>
  209. <text @click='switchType(item)'>{{item.classify?item.classifyName:'默'}}</text>
  210. <uni-icons @click='share(item)' type="redo" size="20" color=''></uni-icons>
  211. </view>
  212. </view>
  213. <view class="right">
  214. <view class="row1 flex">
  215. <text>{{item.name}}</text>
  216. <text class="line"></text>
  217. <text>{{item.post}}</text>
  218. <u-checkbox-group v-if='islongPress' placement="column"
  219. @change="checkboxChange($event,index)">
  220. <u-checkbox :name='index+1' :checked='item.checked'
  221. :customStyle="{marginBottom: '8px'}">
  222. </u-checkbox>
  223. </u-checkbox-group>
  224. </view>
  225. <view class="row2">
  226. {{item.companyName}}
  227. </view>
  228. <view class="row3" @click="toMap(item)">
  229. <uni-icons type="redo" size="20"></uni-icons>
  230. <text>{{item.province}}{{item.city}}{{item.area}}{{item.detailedAddress}}</text>
  231. </view>
  232. <view class="row3">
  233. <uni-icons type="redo" size="20"></uni-icons>
  234. <text>{{item.phone}}</text>
  235. </view>
  236. <view @click='remarkEdit(item)' class="row3">
  237. <uni-icons type="redo" size="20"></uni-icons>
  238. <text>{{item.remark?item.remark:'单击添加备注'}}</text>
  239. </view>
  240. </view> -->
  241. </view>
  242. </mescroll-body>
  243. </view>
  244. <view class="del-style" v-if="islongPress">
  245. <view class="left">
  246. <text class="qx" @click="islongPress=false">取消</text>
  247. <text class="del" @click="del">删除</text>
  248. </view>
  249. <view style='width:128rpx;' class="right flex">
  250. <view>全选</view>
  251. <u-checkbox-group class='' placement="column"
  252. @change="checkboxChange($event,'')">
  253. <u-checkbox iconColor='#4977FC' activeColor="#fff" name='全选' :checked='checked'
  254. :customStyle="{marginBottom: '8px',position: 'relative',top: '-19px',right:'-8px'}">
  255. </u-checkbox>
  256. </u-checkbox-group>
  257. </view>
  258. </view>
  259. <u-picker :show="isShowType" :columns="typeColumns" keyName="circleName" :title="type == 2?'修改分类':'选择分类'" @close="isShowType=false"
  260. @cancel="isShowType=false" closeOnClickOverlay @confirm="typeConfirm"></u-picker>
  261. <u-toast ref="uToast"></u-toast>
  262. <u-modal :show="delShow" title="提示" confirmText='确定' showCancelButton='true' @cancel="delShow=false" @confirm="delConfirm"
  263. :content='"已选中"+this.checkedList.length+"张名片,确定删除?"'></u-modal>
  264. <u-modal :show="modalShow" @confirm='remarkConfirm' :confirmColor="remark?'#2979ff':'#ccc'"
  265. showCancelButton='true' title="备注">
  266. <view class="slot-content">
  267. <u--textarea v-model="remark" placeholder="输入备注,不超过150个字"></u--textarea>
  268. </view>
  269. </u-modal>
  270. <u-popup :show="qrcodeShow" @close="qrcodeShow=false" mode="center" :round='10'>
  271. <image style='margin:10px;' :src="currectData.qrCode" mode="widthFix"></image>
  272. </u-popup>
  273. <u-popup :show="popupshow" :closeOnClickOverlay='true' :overlayOpacity='0.4' @close='handleHiddenShare' :round="10" mode="bottom">
  274. <view>
  275. <!-- <view class="share-to">
  276. <text>分享到</text>
  277. </view> -->
  278. <view class="share-content">
  279. <view class="block" @click="toUrl()">
  280. <button class="moment">
  281. <image style='width:108rpx;height:108rpx;' src="@/static/imgs/scancode.png" mode="aspectFill"></image>
  282. <view>扫码分享</view>
  283. </button>
  284. </view>
  285. <view class="block">
  286. <button class="shareBtn" type="default" data-name="shareBtn" open-type="share">
  287. <image style='width:108rpx;height:108rpx;' src="@/static/imgs/shade.png" mode="aspectFill"></image>
  288. <view>分享微信好友</view>
  289. </button>
  290. </view>
  291. </view>
  292. </view>
  293. </u-popup>
  294. <!-- <image :src="poster" style="width: 750rpx;height: 1334rpx;"></image> -->
  295. <!-- 生成图片 -->
  296. <poster :data="canvasData" background-color="#FFF"
  297. :width='750' :height='420'
  298. @on-success="posterSuccess" ref="poster" @on-error="posterError"></poster>
  299. </view>
  300. </template>
  301. <script>
  302. import Poster from '../../components/zhangyuhao-poster/Poster.vue'
  303. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  304. export default {
  305. mixins: [MescrollMixin],
  306. components: {
  307. Poster
  308. },
  309. data() {
  310. return {
  311. canReset: false,
  312. poster: '',
  313. canvasData: {},
  314. searchVal: '',
  315. isShowType: false,
  316. loading: true,
  317. typeName: '',
  318. typeColumns: [],
  319. cardHolderList: [],
  320. currectData: [],
  321. type: 1,
  322. popupshow: false,
  323. modalShow: false,
  324. remark: '',
  325. islongPress: false,
  326. checked: false,
  327. checkedList: [],
  328. delShow: false,
  329. qrcodeShow: false,
  330. unread: 0,
  331. clicknum:0,
  332. noticeList: [],
  333. };
  334. },
  335. onShow() {
  336. if (uni.getStorageSync("userInfo")) {
  337. this.userInfo = uni.getStorageSync("userInfo")
  338. this.$nextTick(function() {
  339. this.canReset && this.mescroll.resetUpScroll() // 重置列表数据为第一页
  340. this.canReset && this.mescroll.scrollTo(0, 0) // 重置列表数据为第一页时,建议把滚动条也重置到顶部,避免无法再次翻页的问题
  341. this.canReset = true // 过滤第一次的onShow事件,避免初始化界面时重复触发upCallback, 无需配置auto:false
  342. });
  343. } else {
  344. this.login()
  345. }
  346. this.searchVal = uni.getStorageSync("search_val") ? uni.getStorageSync("search_val") : ''
  347. },
  348. mounted() {
  349. },
  350. onLoad: function() {
  351. wx.showShareMenu({
  352. withShareTicket: true,
  353. menus: ["shareAppMessage", "shareTimeline"]
  354. })
  355. },
  356. onShareAppMessage(res) {
  357. console.log(res,this.popupshow)
  358. let that = this;
  359. //生成名片图片
  360. let imageUrl = this.poster
  361. console.log("imageUrl", imageUrl)
  362. if (res.from === 'button') {
  363. let path = `/pages/cardHolder/scanCodeAddCard?id=${that.currectData.id}`
  364. return {
  365. title: this.popupshow?`${that.currectData.name}分享的名片~`:'电子名片',
  366. path: path,
  367. imageUrl: this.popupshow?imageUrl:'',
  368. };
  369. }
  370. if (res.from === 'menu') {
  371. return {
  372. title: '商通线上商城',
  373. path: '/pages/tabBarPro/index/index',
  374. imageUrl: this.popupshow?imageUrl:''
  375. };
  376. }
  377. },
  378. // 分享到朋友圈
  379. onShareTimeline() {
  380. return {
  381. title: '商通线上商城',
  382. path: '/pages/index/index',
  383. imageUrl: 'https://cdn.uviewui.com/uview/swiper/1.jpg'
  384. };
  385. },
  386. methods: {
  387. delVal(){
  388. this.searchVal =""
  389. this.mescroll.resetUpScroll()
  390. },
  391. handleHiddenShare(){
  392. console.log(11111)
  393. this.popupshow=false
  394. },
  395. posterError(err) {
  396. console.log(err)
  397. uni.hideLoading()
  398. },
  399. posterSuccess(url) {
  400. console.log("hahahah",url)
  401. // 生成成功,会把临时路径在这里返回
  402. this.poster = url;
  403. this.popupshow = true
  404. console.log(url)
  405. uni.hideLoading()
  406. },
  407. toHome(item) {
  408. uni.navigateTo({
  409. url: "/pages/mySet/myHome?id=" + item.personalHomeId
  410. })
  411. },
  412. delSearchVal() {
  413. this.searchVal = ""
  414. uni.removeStorageSync('search_val')
  415. this.mescroll.resetUpScroll()
  416. },
  417. toUrl() {
  418. console.log(this.currectData)
  419. this.popupshow = false
  420. this.qrcodeShow = true
  421. },
  422. share(item) {
  423. uni.showLoading({
  424. title: '加载中',
  425. mask: true
  426. })
  427. this.currectData = item
  428. var data = [{
  429. type: 'image',
  430. path: this.currectData.currentBackground,
  431. use:'bg',
  432. x: -10,
  433. y: 0,
  434. width: 530,
  435. height: 325
  436. },
  437. {
  438. type: 'image',
  439. path: this.currectData.headSculpture,
  440. shape: 'circle',
  441. use:'head',
  442. x: 30,
  443. y: 30,
  444. width: 100,
  445. height: 100
  446. },
  447. {
  448. type: 'text',
  449. text:this.currectData.name,
  450. use:'name',
  451. x: 150,
  452. y: 50,
  453. size:24,
  454. color:'#000'
  455. },
  456. {
  457. type: 'text',
  458. text:this.currectData.post,
  459. use:'post',
  460. x: 240,
  461. y: 55,
  462. size:18,
  463. color:'#666666'
  464. },
  465. {
  466. type: 'text',
  467. text:this.currectData.companyName,
  468. use:'companyName',
  469. x: 150,
  470. y: 95,
  471. size:18,
  472. color:'#000'
  473. },
  474. {
  475. type: 'image',
  476. path: '../../static/imgs/card/address1.png',
  477. use:'address-icon',
  478. x: 145,
  479. y: 130,
  480. width: 15,
  481. height: 20
  482. },
  483. {
  484. type: 'textarea',
  485. text:this.currectData.province+this.currectData.city+this.currectData.area+this.currectData.detailedAddress,
  486. lineSpace:1,
  487. width:320,
  488. use:'address',
  489. x: 175,
  490. y: 135,
  491. size:14,
  492. color:'#000'
  493. },
  494. {
  495. type: 'image',
  496. path: '../../static/imgs/card/phone1.png',
  497. use:'phone-icon',
  498. x: 145,
  499. y: 163,
  500. width: 16,
  501. height: 16
  502. },
  503. {
  504. type: 'text',
  505. text:this.currectData.phone,
  506. use:'phone',
  507. x: 175,
  508. y: 167,
  509. size:14,
  510. color:'#000'
  511. },
  512. {
  513. type: 'image',
  514. path: '../../static/imgs/card/remark1.png',
  515. use:'remark-icon',
  516. x: 145,
  517. y: 197,
  518. width: 13,
  519. height: 16
  520. },
  521. {
  522. type: 'textarea',
  523. text:this.currectData.remark?this.currectData.remark:'单击添加备注',
  524. use:'remark',
  525. lineSpace:2,
  526. width:200,
  527. x: 175,
  528. y: 200,
  529. size:13,
  530. color:'#000'
  531. },
  532. {
  533. type: 'image',
  534. path: '../../static/imgs/card/bg3.png',
  535. use:'bg1',
  536. x: 0,
  537. y: 243,
  538. width: 370,
  539. height: 67
  540. },
  541. {
  542. type: 'image',
  543. path: '../../static/imgs/card/bg4.png',
  544. use:'bg2',
  545. x: 355,
  546. y: 243,
  547. width: 150,
  548. height: 67
  549. },
  550. {
  551. type: 'image',
  552. path: '../../static/imgs/card/home.png',
  553. use:'home',
  554. x: 65,
  555. y: 260,
  556. width: 33,
  557. height: 33
  558. },
  559. {
  560. type: 'text',
  561. text:this.currectData.classifyName?this.currectData.classifyName:'默',
  562. use:'classify',
  563. x: 145,
  564. y: 263,
  565. size:34,
  566. color:'#fff'
  567. },
  568. {
  569. type: 'image',
  570. path: '../../static/imgs/card/share.png',
  571. use:'share',
  572. x: 235,
  573. y: 263,
  574. width: 33,
  575. height: 28
  576. },
  577. ]
  578. console.log(this.currectData.cuttentTemplate,111111)
  579. for(var i=0;i<data.length;i++){
  580. switch (this.currectData.cuttentTemplate) {
  581. case '2':
  582. if(data[i].use==='name'
  583. ||data[i].use==='companyName'
  584. ||data[i].use==='address-icon'
  585. ||data[i].use==='phone-icon'
  586. ||data[i].use==='remark-icon'){
  587. data[i].x=30
  588. }
  589. if(data[i].use==='post'){
  590. data[i].x=100
  591. }
  592. if(data[i].use==='address'
  593. ||data[i].use==='phone'
  594. ||data[i].use==='remark'){
  595. data[i].x=60
  596. }
  597. if(data[i].use=='head'){
  598. data[i].x=370
  599. }
  600. break;
  601. case '3':
  602. if(data[i].use==='name'){
  603. data[i].x=30
  604. data[i].y=150
  605. }
  606. if(data[i].use==='companyName'){
  607. data[i].x=30
  608. data[i].y=180
  609. }
  610. if(data[i].use==='post'){
  611. data[i].x=100
  612. data[i].y=153
  613. }
  614. if(data[i].use==='address-icon'
  615. ||data[i].use==='phone-icon'
  616. ||data[i].use==='remark-icon'){
  617. data[i].x=170
  618. }
  619. if(data[i].use==='address-icon'){data[i].y=150}
  620. if(data[i].use==='address'){data[i].y=155;data[i].width=300}
  621. if(data[i].use==='phone-icon'){data[i].y=180}
  622. if(data[i].use==='phone'){data[i].y=183}
  623. if(data[i].use==='remark-icon'){data[i].y=210}
  624. if(data[i].use==='remark'){data[i].y=212}
  625. if(data[i].use==='address'
  626. ||data[i].use==='phone'
  627. ||data[i].use==='remark'){
  628. data[i].x=190
  629. }
  630. break;
  631. case '4':
  632. if(data[i].use==='name'
  633. ||data[i].use==='companyName'){
  634. data[i].x=30
  635. }
  636. if(data[i].use==='companyName'){
  637. data[i].y=90
  638. }
  639. if(data[i].use==='post'){
  640. data[i].x=100
  641. }
  642. if(data[i].use=='head'){
  643. data[i].x=25
  644. data[i].y=120
  645. }
  646. if(data[i].use==='address-icon'
  647. ||data[i].use==='phone-icon'
  648. ||data[i].use==='remark-icon'){
  649. data[i].x=170
  650. }
  651. if(data[i].use==='address'){data[i].width=300}
  652. if(data[i].use==='address'
  653. ||data[i].use==='phone'
  654. ||data[i].use==='remark'){
  655. data[i].x=190
  656. }
  657. break;
  658. default:
  659. }
  660. }
  661. this.canvasData= {clicknum:this.clicknum++,list:data}
  662. },
  663. async delConfirm() {
  664. uni.showLoading({
  665. title: '数据加载中',
  666. mask: true
  667. })
  668. for (var i = 0; i < this.checkedList.length; i++) {
  669. await this.$request.baseRequest('admin.unimall.cardHolderInfo', 'delete', {
  670. id: this.checkedList[i].data.id,
  671. }, failres => {
  672. console.log('res+++++', failres.errmsg)
  673. this.$refs.uToast.show({
  674. type: 'error',
  675. message: failres.errmsg,
  676. })
  677. }).then(res => {
  678. console.log(i, this.checkedList.length - 1)
  679. if (i == this.checkedList.length - 1) {
  680. uni.hideLoading()
  681. this.$refs.uToast.show({
  682. type: 'success',
  683. message: '删除成功',
  684. })
  685. this.delShow = false
  686. this.islongPress = false
  687. this.mescroll.resetUpScroll()
  688. }
  689. })
  690. }
  691. },
  692. del() {
  693. if(this.checkedList.length>0){
  694. this.delShow = true
  695. }else{
  696. this.$refs.uToast.show({
  697. type: 'error',
  698. message: '请勾选后再进行删除!',
  699. })
  700. }
  701. },
  702. longpress() {
  703. console.log("长按事件", 1111111111);
  704. this.islongPress = true;
  705. },
  706. checkboxChange(e, i) {
  707. console.log(e, i, 111111111)
  708. if (i === '') {
  709. console.log(this.checked)
  710. this.checked = !this.checked;
  711. this.cardHolderList.map(item => item.checked = this.checked);
  712. this.$forceUpdate()
  713. var checkList = this.cardHolderList.filter((item) => {
  714. return item.checked == true
  715. })
  716. var data = checkList.map((item, index) => {
  717. return {
  718. index: index,
  719. data: item
  720. }
  721. })
  722. this.checkedList = JSON.parse(JSON.stringify(data))
  723. } else {
  724. if (e[0]) {
  725. this.checkedList.push({
  726. index: i,
  727. data: this.cardHolderList[i]
  728. })
  729. } else {
  730. var index = this.checkedList.findIndex((item) => {
  731. return item.index == i
  732. })
  733. this.checkedList.splice(index, 1)
  734. }
  735. if (this.checkedList.length != this.cardHolderList.length) {
  736. this.checked = false
  737. }
  738. }
  739. // for(var i=0;i<this.cardList.length;i++){
  740. // console.log(this.cardList[i].checked)
  741. // // if(this.cardList[i].checkedList.length>0){
  742. // // this.checkedList.push(i)
  743. // // }
  744. // }
  745. console.log(this.checkedList)
  746. },
  747. remarkConfirm() {
  748. if (this.remark) {
  749. this.currectData.remark = this.remark
  750. this.$request.baseRequest('admin.unimall.cardHolderInfo', 'update', {
  751. cardHolderInfo: JSON.stringify(this.currectData),
  752. }, failres => {
  753. console.log('res+++++', failres.errmsg)
  754. this.$refs.uToast.show({
  755. type: 'error',
  756. message: failres.errmsg,
  757. })
  758. }).then(res => {
  759. this.$refs.uToast.show({
  760. type: 'success',
  761. message: '修改备注成功',
  762. })
  763. this.modalShow = false
  764. this.mescroll.resetUpScroll()
  765. })
  766. }
  767. },
  768. remarkEdit(item) {
  769. this.currectData = item
  770. this.modalShow = true
  771. },
  772. switchType(item) {
  773. this.type = 2
  774. this.currectData = item
  775. this.isShowType = true
  776. },
  777. typeConfirm(e) {
  778. if (this.type == 2) {
  779. this.currectData.classify = e.value[0].circleName
  780. this.$request.baseRequest('admin.unimall.cardHolderInfo', 'update', {
  781. cardHolderInfo: JSON.stringify(this.currectData),
  782. }, failres => {
  783. console.log('res+++++', failres.errmsg)
  784. this.$refs.uToast.show({
  785. type: 'error',
  786. message: failres.errmsg,
  787. })
  788. }).then(res => {
  789. this.$refs.uToast.show({
  790. type: 'success',
  791. message: '修改分类成功',
  792. })
  793. this.mescroll.resetUpScroll()
  794. })
  795. } else {
  796. this.typeName = e.value[0].circleName
  797. }
  798. this.isShowType = false
  799. },
  800. async upCallback(page) {
  801. var that = this
  802. uni.showLoading({
  803. title: '数据加载中'
  804. })
  805. await this.$request.baseRequest('admin.unimall.cardHolderInfo', 'list', {
  806. page: page.num,
  807. limit: page.size,
  808. commonId: uni.getStorageSync("userInfo").id,
  809. searchContent: this.searchVal
  810. }, failres => {
  811. console.log('res+++++', failres.errmsg)
  812. this.$refs.uToast.show({
  813. type: 'error',
  814. message: failres.errmsg,
  815. })
  816. uni.hideLoading()
  817. }).then(res => {
  818. console.log(res)
  819. if (page.num == 1) this.cardHolderList = [];
  820. let curPageLen = res.data.items.length;
  821. let totalPage = res.data.total;
  822. for (var i = 0; i < res.data.items.length; i++) {
  823. res.data.items[i].checked = false
  824. if (res.data.items[i].classify) {
  825. res.data.items[i].classifyName = res.data.items[i].classify[0]
  826. }
  827. }
  828. this.cardHolderList = res.data.items
  829. this.loading = false
  830. this.$nextTick(() => {
  831. that.mescroll.endBySize(curPageLen, totalPage)
  832. });
  833. uni.hideLoading()
  834. })
  835. await this.$request.baseRequest('admin.unimall.cardClassifyInfo', 'list', {
  836. page: 1,
  837. limit: 9999,
  838. commonId: uni.getStorageSync("userInfo").id
  839. }, failres => {
  840. console.log('res+++++', failres.errmsg)
  841. this.$refs.uToast.show({
  842. type: 'error',
  843. message: failres.errmsg,
  844. })
  845. }).then(res => {
  846. this.typeColumns = [res.data.items]
  847. console.log(this.typeColumns)
  848. })
  849. await this.$request.baseRequest('admin.unimall.cardNewsInfo', 'list', {
  850. receiveId: uni.getStorageSync("userInfo").id,
  851. }, failres => {
  852. console.log('res+++++', failres.errmsg)
  853. this.$refs.uToast.show({
  854. type: 'error',
  855. message: failres.errmsg,
  856. })
  857. }).then(res => {
  858. this.noticeList = res.data.items
  859. if (this.noticeList.length > 0) {
  860. var data = this.noticeList.filter((item) => {
  861. return item.newsFlag == 0
  862. })
  863. this.unread = data ? data.length : 0
  864. }
  865. console.log(this.unread)
  866. })
  867. },
  868. login() {
  869. let that = this
  870. uni.login({
  871. "provider": "weixin",
  872. success: function(wxres) {
  873. that.$request.baseRequest('commonUserApp', 'commonUserLogin', {
  874. loginType: 1,
  875. raw: JSON.stringify(wxres)
  876. }, failres => {
  877. this.$refs.uToast.show({
  878. type: 'error',
  879. message: failres.errmsg,
  880. })
  881. uni.hideLoading()
  882. }).then(res => {
  883. uni.getUserInfo({
  884. provider: 'weixin',
  885. success: function(info) {
  886. console.log(info)
  887. res.data.nickname = info.userInfo.nickName
  888. res.data.head = info.userInfo.avatarUrl
  889. that.$request.baseRequest('commonUserApp', 'edit', {
  890. commonUserInfo: JSON.stringify(res.data)
  891. }, failres => {
  892. this.$refs.uToast.show({
  893. type: 'error',
  894. message: failres.errmsg,
  895. })
  896. uni.hideLoading()
  897. }).then(res1 => {
  898. uni.setStorageSync("userInfo", res1.data)
  899. })
  900. }
  901. })
  902. })
  903. },
  904. fail: function(err) {
  905. // 登录授权失败
  906. // err.code是错误码
  907. }
  908. })
  909. },
  910. toNotice() {
  911. uni.navigateTo({
  912. url: "/pages/cardHolder/notice"
  913. })
  914. },
  915. micOpen: function() {
  916. uni.navigateTo({
  917. url: "/pages/cardHolder/search?mic=1"
  918. })
  919. },
  920. uploadFile: function(tempFilePath) {
  921. return new Promise((resolve, reject) => {
  922. //调用你的接口把音频文件转为文字
  923. this.$minApi.upload('txasr/SentenceRecognition', null, tempFilePath)
  924. .then(res => {
  925. if (res.code == 1) {
  926. resolve(res.data.Result);
  927. } else {
  928. reject(e);
  929. }
  930. })
  931. .catch(e => {
  932. reject(e);
  933. });
  934. });
  935. },
  936. search() {
  937. uni.navigateTo({
  938. url: "/pages/cardHolder/search"
  939. })
  940. },
  941. input(res) {
  942. console.log('----input:', res)
  943. },
  944. clear(res) {
  945. uni.showToast({
  946. title: 'clear事件,清除值为:' + res.value,
  947. icon: 'none'
  948. })
  949. },
  950. blur(res) {
  951. uni.showToast({
  952. title: 'blur事件,输入值为:' + res.value,
  953. icon: 'none'
  954. })
  955. },
  956. focus(e) {
  957. uni.showToast({
  958. title: 'focus事件,输出值为:' + e.value,
  959. icon: 'none'
  960. })
  961. },
  962. cancel(res) {
  963. uni.showToast({
  964. title: '点击取消,输入值为:' + res.value,
  965. icon: 'none'
  966. })
  967. },
  968. selectType() {
  969. this.isShowType = true
  970. this.type = 1
  971. },
  972. scan() {
  973. // console.log(1)
  974. // uni.navigateTo({
  975. // url: "/pages/cardHolder/scancode"
  976. // })
  977. uni.scanCode({
  978. success: function(res) {
  979. console.log('条码类型:' + res.scanType);
  980. console.log('条码内容:' + res.result);
  981. uni.navigateTo({
  982. url: "/pages/cardHolder/scanCodeAddCard?id=" + res.result
  983. })
  984. }
  985. });
  986. },
  987. toMap(item) {
  988. uni.navigateTo({
  989. url: "/pages/cardHolder/map?location=" + item.location
  990. })
  991. },
  992. }
  993. }
  994. </script>
  995. <style lang="scss" scoped>
  996. .content {
  997. // padding: 0 20rpx;
  998. }
  999. .u-nav-slot {
  1000. /deep/.u-badge {
  1001. position: absolute;
  1002. top: 0;
  1003. right: 6rpx;
  1004. }
  1005. }
  1006. .content1 {
  1007. padding: 20rpx;
  1008. background-color: #112253;
  1009. .search {
  1010. color: #9199af;
  1011. background: #22325f;
  1012. border-radius: 50rpx;
  1013. width: 100%;
  1014. padding: 10rpx 30rpx;
  1015. box-sizing: border-box;
  1016. margin-right: 20rpx;
  1017. }
  1018. }
  1019. .content2 {
  1020. background: #112253;
  1021. color: #fff;
  1022. padding: 20rpx 20rpx 200rpx 20rpx;
  1023. border-radius: 0px 0px 20px 20px;
  1024. }
  1025. .content3 {
  1026. // padding:0 20rpx;
  1027. position: relative;
  1028. top: -170rpx;
  1029. .style1 {
  1030. display: flex;
  1031. padding: 20rpx 30rpx;
  1032. width: 85%;
  1033. margin-bottom: 90rpx;
  1034. .left {
  1035. width: 132rpx;
  1036. height: 132rpx;
  1037. border-radius: 50%;
  1038. }
  1039. .right {
  1040. margin-left: 40rpx;
  1041. .row1 {
  1042. .name {
  1043. font-size: 38rpx;
  1044. font-weight: bold;
  1045. color: #040000;
  1046. margin-right: 20rpx;
  1047. }
  1048. .post {
  1049. font-size: 26rpx;
  1050. font-weight: 500;
  1051. color: #666666;
  1052. }
  1053. }
  1054. .row2 {
  1055. font-size: 24rpx;
  1056. font-weight: bold;
  1057. color: #323333;
  1058. }
  1059. .row3 {
  1060. margin-top: 30rpx;
  1061. font-size: 24rpx;
  1062. font-weight: 500;
  1063. color: #323333;
  1064. }
  1065. .row2,.row4 {
  1066. margin-top: 10rpx;
  1067. }
  1068. }
  1069. }
  1070. .style2 {
  1071. padding: 30rpx;
  1072. margin-bottom: 100rpx;
  1073. .top {
  1074. .row1 {
  1075. .name {
  1076. font-size: 38rpx;
  1077. font-weight: bold;
  1078. color: #040000;
  1079. margin-right: 20rpx;
  1080. }
  1081. .post {
  1082. font-size: 26rpx;
  1083. font-weight: 500;
  1084. color: #666666;
  1085. }
  1086. }
  1087. .row2 {
  1088. margin-top: 10rpx;
  1089. font-size: 24rpx;
  1090. font-weight: bold;
  1091. color: #323333;
  1092. }
  1093. }
  1094. .bottom {
  1095. margin-top: 48rpx;
  1096. .left {
  1097. margin-right: 40rpx;
  1098. .row1 {
  1099. .name {
  1100. font-size: 38rpx;
  1101. font-weight: bold;
  1102. color: #040000;
  1103. margin-right: 20rpx;
  1104. }
  1105. .post {
  1106. font-size: 26rpx;
  1107. font-weight: 500;
  1108. color: #666666;
  1109. }
  1110. }
  1111. .row2 {
  1112. margin-top: 10rpx;
  1113. font-size: 24rpx;
  1114. font-weight: bold;
  1115. color: #323333;
  1116. }
  1117. }
  1118. .right {
  1119. .row1,
  1120. .row2 {
  1121. font-size: 24rpx;
  1122. font-weight: 500;
  1123. color: #323333;
  1124. }
  1125. .row2,.row4 {
  1126. margin-top: 10rpx;
  1127. }
  1128. }
  1129. }
  1130. }
  1131. .card-list-item {
  1132. width: calc(100%);
  1133. // left:-20rpx;
  1134. position: relative;
  1135. border-radius: 30rpx;
  1136. padding: 40rpx;
  1137. box-sizing: border-box;
  1138. .car-bottom {
  1139. position: absolute;
  1140. bottom: 63rpx;
  1141. left: 20rpx;
  1142. bottom:24rpx;
  1143. width:94.9%;
  1144. background: url("../../static/imgs/card/bg5.png") no-repeat center;
  1145. background-size: 100% 100%;
  1146. height: 80rpx;
  1147. // width: calc(100% - 40rpx);
  1148. .left {
  1149. // top: -40rpx;
  1150. position: absolute;
  1151. padding: 20rpx 0;
  1152. width: 70vw;
  1153. height: 80rpx;
  1154. box-sizing: border-box;
  1155. display: flex;
  1156. align-items: center;
  1157. justify-content: space-evenly;
  1158. z-index:100;
  1159. left: 0px;
  1160. // background-size: 100% 100%;
  1161. overflow-y: hidden;
  1162. }
  1163. }
  1164. .left {
  1165. width: 30%;
  1166. .top {
  1167. margin-bottom: 20rpx;
  1168. }
  1169. .img {
  1170. width: 80%;
  1171. }
  1172. .bottom {}
  1173. }
  1174. .right {
  1175. .row1 {
  1176. .line {
  1177. width: 1px;
  1178. height: 20px;
  1179. margin: 0 20rpx;
  1180. background: black;
  1181. }
  1182. }
  1183. }
  1184. }
  1185. }
  1186. .slot-content {
  1187. width: 100%;
  1188. }
  1189. /deep/.u-checkbox-group{
  1190. position: absolute;
  1191. right: 20px;
  1192. z-index: 99;
  1193. top: 30px;
  1194. }
  1195. .del-style{
  1196. background: #fff;
  1197. padding: 20rpx;
  1198. width:calc(100vw - 40rpx);
  1199. position: fixed;
  1200. display: flex;
  1201. z-index:100;
  1202. justify-content: space-between;
  1203. bottom:0;
  1204. font-size:28rpx;
  1205. .right{
  1206. color:#344577;
  1207. }
  1208. }
  1209. .del,.qx{
  1210. padding:10rpx;
  1211. }
  1212. .del{
  1213. color:#FF4040;
  1214. }
  1215. .qx{
  1216. color:#666;
  1217. }
  1218. .share-content{
  1219. display:flex;
  1220. padding:20rpx;
  1221. justify-content: center;
  1222. button{
  1223. background:transparent;
  1224. line-height:1;
  1225. }
  1226. button:after{
  1227. border:none;
  1228. }
  1229. font-size:24rpx;
  1230. }
  1231. .icon-text{
  1232. margin-left: 10px;
  1233. font-size: 24rpx;
  1234. font-weight: 500;
  1235. color: #323333;
  1236. }
  1237. /deep/.u-checkbox__icon-wrap.u-checkbox__icon-wrap--square{
  1238. border-color:#D7DEEB !important;
  1239. }
  1240. </style>