cardHolder.vue 30 KB

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