cardHolder.vue 28 KB

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