cardHolder.vue 31 KB

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