cardHolder.vue 28 KB

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