cardHolder.vue 28 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123
  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==0">
  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==1">
  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==2">
  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==3">
  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. <<<<<<< HEAD
  248. <poster :list="canvasData" background-color="#FFF"
  249. :width='750' :height='420'
  250. @on-success="posterSuccess" ref="poster" @on-error="posterError"></poster>
  251. =======
  252. <poster :list="canvasData" background-color="#FFF" @on-success="posterSuccess" ref="poster"
  253. @on-error="posterError"></poster>
  254. >>>>>>> 53f9a4ae889bb3cdfdec083420d802cd24b01892
  255. </view>
  256. </template>
  257. <script>
  258. import Poster from '../../components/zhangyuhao-poster/Poster.vue'
  259. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  260. export default {
  261. mixins: [MescrollMixin],
  262. components: {
  263. Poster
  264. },
  265. data() {
  266. return {
  267. canReset: false,
  268. poster: '',
  269. canvasData: [],
  270. searchVal: '',
  271. isShowType: false,
  272. loading: true,
  273. typeName: '',
  274. typeColumns: [],
  275. cardHolderList: [],
  276. currectData: [],
  277. type: 1,
  278. popupshow: false,
  279. modalShow: false,
  280. remark: '',
  281. islongPress: false,
  282. checked: false,
  283. checkedList: [],
  284. delShow: false,
  285. qrcodeShow: false,
  286. unread: 0,
  287. noticeList: [],
  288. };
  289. },
  290. onShow() {
  291. if (uni.getStorageSync("userInfo")) {
  292. this.userInfo = uni.getStorageSync("userInfo")
  293. this.$nextTick(function() {
  294. this.canReset && this.mescroll.resetUpScroll() // 重置列表数据为第一页
  295. this.canReset && this.mescroll.scrollTo(0, 0) // 重置列表数据为第一页时,建议把滚动条也重置到顶部,避免无法再次翻页的问题
  296. this.canReset = true // 过滤第一次的onShow事件,避免初始化界面时重复触发upCallback, 无需配置auto:false
  297. });
  298. } else {
  299. this.login()
  300. }
  301. this.searchVal = uni.getStorageSync("search_val") ? uni.getStorageSync("search_val") : ''
  302. },
  303. mounted() {
  304. },
  305. onLoad: function() {
  306. wx.showShareMenu({
  307. withShareTicket: true,
  308. menus: ["shareAppMessage", "shareTimeline"]
  309. })
  310. },
  311. onShareAppMessage(res) {
  312. console.log(1111)
  313. let that = this;
  314. //生成名片图片
  315. let imageUrl = this.poster
  316. console.log("imageUrl", imageUrl)
  317. if (res.from === 'button') {
  318. let path = `/pages/cardHolder/scanCodeAddCard?id=${that.currectData.id}`
  319. return {
  320. title: `${that.currectData.name}分享的名片~`,
  321. path: path,
  322. imageUrl: imageUrl,
  323. };
  324. }
  325. if (res.from === 'menu') {
  326. return {
  327. title: '商通线上商城',
  328. path: '/pages/tabBarPro/index/index',
  329. imageUrl: imageUrl
  330. };
  331. }
  332. },
  333. // 分享到朋友圈
  334. onShareTimeline() {
  335. return {
  336. title: '商通线上商城',
  337. path: '/pages/index/index',
  338. imageUrl: 'https://cdn.uviewui.com/uview/swiper/1.jpg'
  339. };
  340. },
  341. methods: {
  342. handleHiddenShare(){
  343. this.popupshow=false
  344. },
  345. posterError(err) {
  346. console.log(err)
  347. },
  348. posterSuccess(url) {
  349. console.log("hahahah",url)
  350. // 生成成功,会把临时路径在这里返回
  351. this.poster = url;
  352. this.popupshow=true
  353. console.log(url)
  354. },
  355. toHome(item) {
  356. uni.navigateTo({
  357. url: "/pages/mySet/myHome?id=" + item.personalHomeId
  358. })
  359. },
  360. delSearchVal() {
  361. this.searchVal = ""
  362. uni.removeStorageSync('search_val')
  363. this.mescroll.resetUpScroll()
  364. },
  365. toUrl() {
  366. console.log(this.currectData)
  367. this.popupshow = false
  368. this.qrcodeShow = true
  369. },
  370. share(item) {
  371. this.currectData = item
  372. this.canvasData = [{
  373. type: 'image',
  374. path: item.currentBackground,
  375. use:'bg',
  376. x: -10,
  377. y: 0,
  378. width: 530,
  379. height: 325
  380. },
  381. {
  382. type: 'image',
  383. path: item.headSculpture,
  384. shape: 'circle',
  385. use:'head',
  386. x: 30,
  387. y: 30,
  388. width: 100,
  389. height: 100
  390. },
  391. {
  392. type: 'text',
  393. text:item.name,
  394. use:'name',
  395. x: 150,
  396. y: 50,
  397. size:26,
  398. color:'#000'
  399. },
  400. {
  401. type: 'text',
  402. text:item.post,
  403. use:'post',
  404. x: 240,
  405. y: 55,
  406. size:20,
  407. color:'#666666'
  408. },
  409. {
  410. type: 'text',
  411. text:item.companyName,
  412. use:'companyName',
  413. x: 150,
  414. y: 95,
  415. size:20,
  416. color:'#000'
  417. },
  418. {
  419. type: 'image',
  420. path: '../../static/imgs/card/address2.png',
  421. use:'address-icon',
  422. x: 145,
  423. y: 125,
  424. width: 30,
  425. height: 28
  426. },
  427. {
  428. type: 'textarea',
  429. text:item.province+item.city+item.area+item.detailedAddress,
  430. lineSpace:1,
  431. width:320,
  432. use:'address',
  433. x: 175,
  434. y: 135,
  435. size:14,
  436. color:'#000'
  437. },
  438. {
  439. type: 'image',
  440. path: '../../static/imgs/card/phone.png',
  441. use:'phone-icon',
  442. x: 145,
  443. y: 160,
  444. width: 26,
  445. height: 26
  446. },
  447. {
  448. type: 'text',
  449. text:item.phone,
  450. use:'phone',
  451. x: 175,
  452. y: 167,
  453. size:14,
  454. color:'#000'
  455. },
  456. {
  457. type: 'image',
  458. path: '../../static/imgs/card/remark.png',
  459. use:'remark-icon',
  460. x: 145,
  461. y: 190,
  462. width: 30,
  463. height: 30
  464. },
  465. {
  466. type: 'textarea',
  467. text:item.remark?item.remark:'单击添加备注',
  468. use:'remark',
  469. lineSpace:2,
  470. width:200,
  471. x: 180,
  472. y: 200,
  473. size:13,
  474. color:'#000'
  475. },
  476. {
  477. type: 'image',
  478. path: '../../static/imgs/card/bg3.png',
  479. use:'bg1',
  480. x: 0,
  481. y: 243,
  482. width: 370,
  483. height: 67
  484. },
  485. {
  486. type: 'image',
  487. path: '../../static/imgs/card/bg4.png',
  488. use:'bg2',
  489. x: 355,
  490. y: 243,
  491. width: 150,
  492. height: 67
  493. },
  494. {
  495. type: 'image',
  496. path: '../../static/imgs/card/home.png',
  497. use:'home',
  498. x: 65,
  499. y: 260,
  500. width: 33,
  501. height: 33
  502. },
  503. {
  504. type: 'text',
  505. text:item.classifyName?item.classifyName:'默',
  506. use:'phone',
  507. x: 145,
  508. y: 263,
  509. size:34,
  510. color:'#fff'
  511. },
  512. {
  513. type: 'image',
  514. path: '../../static/imgs/card/share.png',
  515. use:'share',
  516. x: 235,
  517. y: 263,
  518. width: 33,
  519. height: 28
  520. },
  521. ]
  522. // this.popupshow = true
  523. },
  524. async delConfirm() {
  525. uni.showLoading({
  526. title: '数据加载中',
  527. mask: true
  528. })
  529. for (var i = 0; i < this.checkedList.length; i++) {
  530. await this.$request.baseRequest('admin.unimall.cardHolderInfo', 'delete', {
  531. id: this.checkedList[i].data.id,
  532. }, failres => {
  533. console.log('res+++++', failres.errmsg)
  534. this.$refs.uToast.show({
  535. type: 'error',
  536. message: failres.errmsg,
  537. })
  538. }).then(res => {
  539. console.log(i, this.checkedList.length - 1)
  540. if (i == this.checkedList.length - 1) {
  541. uni.hideLoading()
  542. this.$refs.uToast.show({
  543. type: 'success',
  544. message: '删除成功',
  545. })
  546. this.delShow = false
  547. this.islongPress = false
  548. this.mescroll.resetUpScroll()
  549. }
  550. })
  551. }
  552. },
  553. del() {
  554. this.delShow = true
  555. },
  556. longpress() {
  557. console.log("长按事件", 1111111111);
  558. this.islongPress = true;
  559. },
  560. checkboxChange(e, i) {
  561. console.log(e, i, 111111111)
  562. if (i === '') {
  563. console.log(this.checked)
  564. this.checked = !this.checked;
  565. this.cardHolderList.map(item => item.checked = this.checked);
  566. this.$forceUpdate()
  567. var checkList = this.cardHolderList.filter((item) => {
  568. return item.checked == true
  569. })
  570. var data = checkList.map((item, index) => {
  571. return {
  572. index: index,
  573. data: item
  574. }
  575. })
  576. this.checkedList = JSON.parse(JSON.stringify(data))
  577. } else {
  578. if (e[0]) {
  579. this.checkedList.push({
  580. index: i,
  581. data: this.cardHolderList[i]
  582. })
  583. } else {
  584. var index = this.checkedList.findIndex((item) => {
  585. return item.index == i
  586. })
  587. this.checkedList.splice(index, 1)
  588. }
  589. if (this.checkedList.length != this.cardHolderList.length) {
  590. this.checked = false
  591. }
  592. }
  593. // for(var i=0;i<this.cardList.length;i++){
  594. // console.log(this.cardList[i].checked)
  595. // // if(this.cardList[i].checkedList.length>0){
  596. // // this.checkedList.push(i)
  597. // // }
  598. // }
  599. console.log(this.checkedList)
  600. },
  601. remarkConfirm() {
  602. if (this.remark) {
  603. this.currectData.remark = this.remark
  604. this.$request.baseRequest('admin.unimall.cardHolderInfo', 'update', {
  605. cardHolderInfo: JSON.stringify(this.currectData),
  606. }, failres => {
  607. console.log('res+++++', failres.errmsg)
  608. this.$refs.uToast.show({
  609. type: 'error',
  610. message: failres.errmsg,
  611. })
  612. }).then(res => {
  613. this.$refs.uToast.show({
  614. type: 'success',
  615. message: '修改备注成功',
  616. })
  617. this.modalShow = false
  618. this.mescroll.resetUpScroll()
  619. })
  620. }
  621. },
  622. remarkEdit(item) {
  623. this.currectData = item
  624. this.modalShow = true
  625. },
  626. switchType(item) {
  627. this.type = 2
  628. this.currectData = item
  629. this.isShowType = true
  630. },
  631. typeConfirm(e) {
  632. if (this.type == 2) {
  633. this.currectData.classify = e.value[0].circleName
  634. this.$request.baseRequest('admin.unimall.cardHolderInfo', 'update', {
  635. cardHolderInfo: JSON.stringify(this.currectData),
  636. }, failres => {
  637. console.log('res+++++', failres.errmsg)
  638. this.$refs.uToast.show({
  639. type: 'error',
  640. message: failres.errmsg,
  641. })
  642. }).then(res => {
  643. this.$refs.uToast.show({
  644. type: 'success',
  645. message: '修改分类成功',
  646. })
  647. this.mescroll.resetUpScroll()
  648. })
  649. } else {
  650. this.typeName = e.value[0].circleName
  651. }
  652. this.isShowType = false
  653. },
  654. async upCallback(page) {
  655. var that = this
  656. uni.showLoading({
  657. title: '数据加载中'
  658. })
  659. await this.$request.baseRequest('admin.unimall.cardHolderInfo', 'list', {
  660. page: page.num,
  661. limit: page.size,
  662. commonId: uni.getStorageSync("userInfo").id,
  663. searchContent: this.searchVal
  664. }, failres => {
  665. console.log('res+++++', failres.errmsg)
  666. this.$refs.uToast.show({
  667. type: 'error',
  668. message: failres.errmsg,
  669. })
  670. uni.hideLoading()
  671. }).then(res => {
  672. console.log(res)
  673. if (page.num == 1) this.cardHolderList = [];
  674. let curPageLen = res.data.items.length;
  675. let totalPage = res.data.total;
  676. for (var i = 0; i < res.data.items.length; i++) {
  677. res.data.items[i].checked = false
  678. if (res.data.items[i].classify) {
  679. res.data.items[i].classifyName = res.data.items[i].classify[0]
  680. }
  681. }
  682. this.cardHolderList = res.data.items
  683. this.loading = false
  684. this.$nextTick(() => {
  685. that.mescroll.endBySize(curPageLen, totalPage)
  686. });
  687. uni.hideLoading()
  688. })
  689. await this.$request.baseRequest('admin.unimall.cardClassifyInfo', 'list', {
  690. page: 1,
  691. limit: 9999,
  692. commonId: uni.getStorageSync("userInfo").id
  693. }, failres => {
  694. console.log('res+++++', failres.errmsg)
  695. this.$refs.uToast.show({
  696. type: 'error',
  697. message: failres.errmsg,
  698. })
  699. }).then(res => {
  700. this.typeColumns = [res.data.items]
  701. console.log(this.typeColumns)
  702. })
  703. await this.$request.baseRequest('admin.unimall.cardNewsInfo', 'list', {
  704. receiveId: uni.getStorageSync("userInfo").id,
  705. }, failres => {
  706. console.log('res+++++', failres.errmsg)
  707. this.$refs.uToast.show({
  708. type: 'error',
  709. message: failres.errmsg,
  710. })
  711. }).then(res => {
  712. this.noticeList = res.data.items
  713. if (this.noticeList.length > 0) {
  714. var data = this.noticeList.filter((item) => {
  715. return item.newsFlag == 0
  716. })
  717. this.unread = data ? data.length : 0
  718. }
  719. console.log(this.unread)
  720. })
  721. },
  722. login() {
  723. let that = this
  724. uni.login({
  725. "provider": "weixin",
  726. success: function(wxres) {
  727. that.$request.baseRequest('commonUserApp', 'commonUserLogin', {
  728. loginType: 1,
  729. raw: JSON.stringify(wxres)
  730. }, failres => {
  731. this.$refs.uToast.show({
  732. type: 'error',
  733. message: failres.errmsg,
  734. })
  735. uni.hideLoading()
  736. }).then(res => {
  737. uni.getUserInfo({
  738. provider: 'weixin',
  739. success: function(info) {
  740. console.log(info)
  741. res.data.nickname = info.userInfo.nickName
  742. res.data.head = info.userInfo.avatarUrl
  743. that.$request.baseRequest('commonUserApp', 'edit', {
  744. commonUserInfo: JSON.stringify(res.data)
  745. }, failres => {
  746. this.$refs.uToast.show({
  747. type: 'error',
  748. message: failres.errmsg,
  749. })
  750. uni.hideLoading()
  751. }).then(res1 => {
  752. uni.setStorageSync("userInfo", res1.data)
  753. })
  754. }
  755. })
  756. })
  757. },
  758. fail: function(err) {
  759. // 登录授权失败
  760. // err.code是错误码
  761. }
  762. })
  763. },
  764. toNotice() {
  765. uni.navigateTo({
  766. url: "/pages/cardHolder/notice"
  767. })
  768. },
  769. micOpen: function() {
  770. uni.navigateTo({
  771. url: "/pages/cardHolder/search?mic=1"
  772. })
  773. },
  774. uploadFile: function(tempFilePath) {
  775. return new Promise((resolve, reject) => {
  776. //调用你的接口把音频文件转为文字
  777. this.$minApi.upload('txasr/SentenceRecognition', null, tempFilePath)
  778. .then(res => {
  779. if (res.code == 1) {
  780. resolve(res.data.Result);
  781. } else {
  782. reject(e);
  783. }
  784. })
  785. .catch(e => {
  786. reject(e);
  787. });
  788. });
  789. },
  790. search() {
  791. uni.navigateTo({
  792. url: "/pages/cardHolder/search"
  793. })
  794. },
  795. input(res) {
  796. console.log('----input:', res)
  797. },
  798. clear(res) {
  799. uni.showToast({
  800. title: 'clear事件,清除值为:' + res.value,
  801. icon: 'none'
  802. })
  803. },
  804. blur(res) {
  805. uni.showToast({
  806. title: 'blur事件,输入值为:' + res.value,
  807. icon: 'none'
  808. })
  809. },
  810. focus(e) {
  811. uni.showToast({
  812. title: 'focus事件,输出值为:' + e.value,
  813. icon: 'none'
  814. })
  815. },
  816. cancel(res) {
  817. uni.showToast({
  818. title: '点击取消,输入值为:' + res.value,
  819. icon: 'none'
  820. })
  821. },
  822. selectType() {
  823. this.isShowType = true
  824. this.type = 1
  825. },
  826. scan() {
  827. // console.log(1)
  828. // uni.navigateTo({
  829. // url: "/pages/cardHolder/scancode"
  830. // })
  831. uni.scanCode({
  832. success: function(res) {
  833. console.log('条码类型:' + res.scanType);
  834. console.log('条码内容:' + res.result);
  835. uni.navigateTo({
  836. url: "/pages/cardHolder/scanCodeAddCard?id=" + res.result
  837. })
  838. }
  839. });
  840. },
  841. toMap(item) {
  842. uni.navigateTo({
  843. url: "/pages/cardHolder/map?location=" + item.location
  844. })
  845. },
  846. }
  847. }
  848. </script>
  849. <style lang="scss" scoped>
  850. .content {
  851. // padding: 0 20rpx;
  852. }
  853. .u-nav-slot {
  854. /deep/.u-badge {
  855. position: absolute;
  856. top: 0;
  857. right: 6rpx;
  858. }
  859. }
  860. .content1 {
  861. padding: 20rpx;
  862. background-color: #112253;
  863. .search {
  864. color: #9199af;
  865. background: #22325f;
  866. border-radius: 50rpx;
  867. width: 100%;
  868. padding: 10rpx 30rpx;
  869. box-sizing: border-box;
  870. margin-right: 20rpx;
  871. }
  872. }
  873. .content2 {
  874. background: #112253;
  875. color: #fff;
  876. padding: 20rpx 20rpx 200rpx 20rpx;
  877. border-radius: 0px 0px 20px 20px;
  878. }
  879. .content3 {
  880. // padding:0 20rpx;
  881. position: relative;
  882. top: -170rpx;
  883. .style1 {
  884. display: flex;
  885. padding: 20rpx 30rpx;
  886. width: 85%;
  887. margin-bottom: 90rpx;
  888. .left {
  889. width: 132rpx;
  890. height: 132rpx;
  891. border-radius: 50%;
  892. }
  893. .right {
  894. margin-left: 40rpx;
  895. .row1 {
  896. .name {
  897. font-size: 38rpx;
  898. font-weight: bold;
  899. color: #040000;
  900. margin-right: 20rpx;
  901. }
  902. .post {
  903. font-size: 26rpx;
  904. font-weight: 500;
  905. color: #666666;
  906. }
  907. }
  908. .row2 {
  909. margin-top: 20rpx;
  910. font-size: 24rpx;
  911. font-weight: bold;
  912. color: #323333;
  913. }
  914. .row3 {
  915. margin-top: 30rpx;
  916. font-size: 24rpx;
  917. font-weight: 500;
  918. color: #323333;
  919. }
  920. }
  921. }
  922. .style2 {
  923. padding: 30rpx;
  924. margin-bottom: 100rpx;
  925. .top {
  926. .row1 {
  927. .name {
  928. font-size: 38rpx;
  929. font-weight: bold;
  930. color: #040000;
  931. margin-right: 20rpx;
  932. }
  933. .post {
  934. font-size: 26rpx;
  935. font-weight: 500;
  936. color: #666666;
  937. }
  938. }
  939. .row2 {
  940. margin-top: 20rpx;
  941. font-size: 24rpx;
  942. font-weight: bold;
  943. color: #323333;
  944. }
  945. }
  946. .bottom {
  947. margin-top: 48rpx;
  948. .left {
  949. margin-right: 40rpx;
  950. .row1 {
  951. .name {
  952. font-size: 38rpx;
  953. font-weight: bold;
  954. color: #040000;
  955. margin-right: 20rpx;
  956. }
  957. .post {
  958. font-size: 26rpx;
  959. font-weight: 500;
  960. color: #666666;
  961. }
  962. }
  963. .row2 {
  964. margin-top: 20rpx;
  965. font-size: 24rpx;
  966. font-weight: bold;
  967. color: #323333;
  968. }
  969. }
  970. .right {
  971. .row1,
  972. .row2 {
  973. font-size: 24rpx;
  974. font-weight: 500;
  975. color: #323333;
  976. }
  977. .row2 {
  978. margin-top: 20rpx;
  979. }
  980. }
  981. }
  982. }
  983. .card-list-item {
  984. width: calc(100%);
  985. // left:-20rpx;
  986. position: relative;
  987. border-radius: 30rpx;
  988. padding: 40rpx;
  989. box-sizing: border-box;
  990. .car-bottom {
  991. position: absolute;
  992. bottom: 63rpx;
  993. left: 20rpx;
  994. // width: calc(100% - 40rpx);
  995. .left {
  996. // top: -40rpx;
  997. position: absolute;
  998. padding: 20rpx 0;
  999. width: 70vw;
  1000. height: 80rpx;
  1001. box-sizing: border-box;
  1002. display: flex;
  1003. align-items: center;
  1004. justify-content: space-evenly;
  1005. background: url("../../static/imgs/card/bgc1.png") no-repeat center;
  1006. background-size: 100% 100%;
  1007. }
  1008. .right {
  1009. position: absolute;
  1010. left: 65vw;
  1011. height: 80rpx;
  1012. width: 30vw;
  1013. background: url("../../static/imgs/card/right-bgc.png") no-repeat center;
  1014. background-size: 100% 100%;
  1015. }
  1016. }
  1017. .left {
  1018. width: 30%;
  1019. .top {
  1020. margin-bottom: 20rpx;
  1021. }
  1022. .img {
  1023. width: 80%;
  1024. }
  1025. .bottom {}
  1026. }
  1027. .right {
  1028. .row1 {
  1029. .line {
  1030. width: 1px;
  1031. height: 20px;
  1032. margin: 0 20rpx;
  1033. background: black;
  1034. }
  1035. }
  1036. }
  1037. }
  1038. }
  1039. .slot-content {
  1040. width: 100%;
  1041. }
  1042. .shade {
  1043. background: rgba(0, 0, 0, 0.2);
  1044. width: 100%;
  1045. height: 100vh;
  1046. position: fixed;
  1047. top: 0;
  1048. left: 0;
  1049. }
  1050. .qrCode {
  1051. position: absolute;
  1052. top: 50%;
  1053. left: 0;
  1054. right: 0;
  1055. transform: translateY(-50%);
  1056. text-align: center;
  1057. }
  1058. </style>