cardHolder.vue 28 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124
  1. <template>
  2. <view class="content">
  3. <u-navbar title="电子名片" placeholder bgColor="#112253" titleStyle="color:#fff">
  4. <view class="u-nav-slot relative" slot="left">
  5. <u-icon name="bell" size="26" @click="toNotice" color="#fff"></u-icon>
  6. <u-badge :isDot="unread>0?true:false" type="error" class="point"></u-badge>
  7. </view>
  8. </u-navbar>
  9. <view class="content1 flex-row-center">
  10. <view class="search flex flex-between" @click="search">
  11. <view class="left flex">
  12. <uni-icons type="search" size="24" color="#9199af"></uni-icons>
  13. <text class="search-val"> {{searchVal?searchVal:'搜索名片'}}</text>
  14. <uni-icons type="closeempty" size="24" @click.native.stop="delSearchVal"
  15. v-if="searchVal"></uni-icons>
  16. </view>
  17. <view class="right">
  18. <uni-icons type="closeempty" size="24" @click.native.stop="delVal" color="#9199af" v-if="searchVal"></uni-icons>
  19. <uni-icons type="mic" size="24" @click.native.stop="micOpen" color="#9199af"></uni-icons>
  20. </view>
  21. </view>
  22. <view class="col flex">
  23. <uni-icons type="scan" size="30" @click="scan" color="#fff"></uni-icons>
  24. </view>
  25. </view>
  26. <view class="content2">
  27. <view class="all-type flex" @click="selectType">
  28. <text>{{typeName?typeName:'全部分类'}}</text>
  29. <uni-icons type="bottom" size="18" color="#fff"></uni-icons>
  30. </view>
  31. </view>
  32. <view class="content3">
  33. <mescroll-body v-if='cardHolderList' :up="upOption" ref="mescrollRef" @init="mescrollInit" @up="upCallback"
  34. @down="downCallback">
  35. <view v-for='(item,index) in cardHolderList' @longpress="longpress" class="item flex">
  36. <!-- <view class="card-list-item" style="background:red"> -->
  37. <view class="card-list-item"
  38. :style="'background:url('+item.currentBackground+');background-size:100% 100%'">
  39. <view class="card-content style1" v-if="item.cuttentTemplate==0">
  40. <view class="left">
  41. <u--image :showLoading="true" :src="item.headSculpture" width="66px" height="66px"
  42. shape="circle"></u--image>
  43. </view>
  44. <view class="right">
  45. <view class="row1">
  46. <text class="name">{{item.name}}</text>
  47. <text class="post">{{item.post}}</text>
  48. </view>
  49. <view class="row2">
  50. {{item.companyName}}
  51. </view>
  52. <view class="row3 flex" @click="">
  53. <uni-icons type="map-filled" size="20" style="margin-right: 20rpx;"
  54. color="#5e6d82"></uni-icons>{{ item.province }}{{ item.city }}{{ item.area }}
  55. </view>
  56. <view class="row4 flex">
  57. <uni-icons type="phone-filled" size="20" style="margin-right: 20rpx;"
  58. color="#5e6d82"></uni-icons>{{ item.phone }}
  59. </view>
  60. <!-- <view class="">
  61. 备注
  62. </view> -->
  63. </view>
  64. </view>
  65. <view class="card-content style1 flex-between" v-if="item.cuttentTemplate==1">
  66. <view class="right">
  67. <view class="row1">
  68. <text class="name">{{item.name}}</text>
  69. <text class="post">{{item.post}}</text>
  70. </view>
  71. <view class="row2">
  72. {{item.companyName}}
  73. </view>
  74. <view class="row3 flex">
  75. <uni-icons type="map-filled" size="20" style="margin-right: 20rpx;"
  76. color="#5e6d82"></uni-icons>{{ item.province }}{{ item.city }}{{ item.area }}
  77. </view>
  78. <view class="row4 flex">
  79. <uni-icons type="phone-filled" size="20" style="margin-right: 20rpx;"
  80. color="#5e6d82"></uni-icons>{{ item.phone }}
  81. </view>
  82. <!-- <view class="">
  83. 备注
  84. </view> -->
  85. </view>
  86. <view class="left">
  87. <u--image :showLoading="true" :src="item.headSculpture" width="66px" height="66px"
  88. shape="circle" v-if="item.headSculpture"></u--image>
  89. <u--image :showLoading="true" src="/./../static/imgs/card/defaulthead.png" width="66px"
  90. height="66px" shape="circle" v-else></u--image>
  91. </view>
  92. </view>
  93. <view class="card-content style2" v-if="item.cuttentTemplate==2">
  94. <view class="top">
  95. <u--image :showLoading="true" :src="item.headSculpture" width="66px" height="66px"
  96. shape="circle" v-if="item.headSculpture"></u--image>
  97. <u--image :showLoading="true" src="/./../static/imgs/card/defaulthead.png" width="66px"
  98. height="66px" shape="circle" v-else></u--image>
  99. </view>
  100. <view class="bottom flex">
  101. <view class="left">
  102. <view class="row1">
  103. <text class="name">{{item.name}}</text>
  104. <text class="post">{{item.post}}</text>
  105. </view>
  106. <view class="row2">
  107. {{item.companyName}}
  108. </view>
  109. </view>
  110. <view class="right">
  111. <view class="row1 flex">
  112. <uni-icons type="map-filled" size="20" style="margin-right: 20rpx;"
  113. color="#5e6d82"></uni-icons>{{ item.province }}{{ item.city }}{{ item.area }}
  114. </view>
  115. <view class="row2 flex">
  116. <uni-icons type="phone-filled" size="20" style="margin-right: 20rpx;"
  117. color="#5e6d82"></uni-icons>{{ item.phone }}
  118. </view>
  119. </view>
  120. </view>
  121. </view>
  122. <view class="card-content style2" v-if="item.cuttentTemplate==3">
  123. <view class="top">
  124. <view class="row1">
  125. <text class="name">{{item.name}}</text>
  126. <text class="post">{{item.post}}</text>
  127. </view>
  128. <view class="row2">
  129. {{item.companyName}}
  130. </view>
  131. </view>
  132. <view class="bottom flex">
  133. <view class="left">
  134. <u--image :showLoading="true" :src="item.headSculpture" width="66px" height="66px"
  135. shape="circle" v-if="item.headSculpture"></u--image>
  136. <u--image :showLoading="true" src="/./../static/imgs/card/defaulthead.png"
  137. width="66px" height="66px" shape="circle" v-else></u--image>
  138. </view>
  139. <view class="right">
  140. <view class="row1 flex">
  141. <uni-icons type="map-filled" size="20" style="margin-right: 20rpx;"
  142. color="#5e6d82"></uni-icons>{{ item.province }}{{ item.city }}{{ item.area }}
  143. </view>
  144. <view class="row2 flex">
  145. <uni-icons type="phone-filled" size="20" style="margin-right: 20rpx;"
  146. color="#5e6d82"></uni-icons>{{ item.phone }}
  147. </view>
  148. </view>
  149. </view>
  150. </view>
  151. <view class="car-bottom flex">
  152. <view class="left">
  153. <image src="../../static/imgs/card/home.png" mode="widthFix" style="width: 32rpx;"
  154. @click="toHome(item)"></image>
  155. <text @click='switchType(item)'
  156. style="color: #fff;">{{item.classify?item.classifyName:'默'}}</text>
  157. <image src="../../static/imgs/card/share.png" mode="widthFix" style="width: 35rpx;"
  158. @click="share(item)"></image>
  159. </view>
  160. <view class="right">
  161. </view>
  162. </view>
  163. </view>
  164. <!-- <view class="left">
  165. <view class="top flex-row-center">
  166. <image :src="item.headSculpture" mode="widthFix" class="img"></image>
  167. </view>
  168. <view class="bottom flex flex-evenly">
  169. <uni-icons @click="toHome(item)" type="home" size="20"></uni-icons>
  170. <text @click='switchType(item)'>{{item.classify?item.classifyName:'默'}}</text>
  171. <uni-icons @click='share(item)' type="redo" size="20" color=''></uni-icons>
  172. </view>
  173. </view>
  174. <view class="right">
  175. <view class="row1 flex">
  176. <text>{{item.name}}</text>
  177. <text class="line"></text>
  178. <text>{{item.post}}</text>
  179. <u-checkbox-group v-if='islongPress' placement="column"
  180. @change="checkboxChange($event,index)">
  181. <u-checkbox :name='index+1' :checked='item.checked'
  182. :customStyle="{marginBottom: '8px'}">
  183. </u-checkbox>
  184. </u-checkbox-group>
  185. </view>
  186. <view class="row2">
  187. {{item.companyName}}
  188. </view>
  189. <view class="row3" @click="toMap(item)">
  190. <uni-icons type="redo" size="20"></uni-icons>
  191. <text>{{item.province}}{{item.city}}{{item.area}}{{item.detailedAddress}}</text>
  192. </view>
  193. <view class="row3">
  194. <uni-icons type="redo" size="20"></uni-icons>
  195. <text>{{item.phone}}</text>
  196. </view>
  197. <view @click='remarkEdit(item)' class="row3">
  198. <uni-icons type="redo" size="20"></uni-icons>
  199. <text>{{item.remark?item.remark:'单击添加备注'}}</text>
  200. </view>
  201. </view> -->
  202. </view>
  203. </mescroll-body>
  204. </view>
  205. <u-picker :show="isShowType" :columns="typeColumns" keyName="circleName" title="选择分类" @close="isShowType=false"
  206. @cancel="isShowType=false" closeOnClickOverlay @confirm="typeConfirm"></u-picker>
  207. <u-toast ref="uToast"></u-toast>
  208. <u-modal :show="delShow" title="提示" showCancelButton='true' @cancel="delShow=false" @confirm="delConfirm"
  209. :content='"已选中"+this.checkedList.length+"张名片,确定删除?"'></u-modal>
  210. <u-modal :show="modalShow" @confirm='remarkConfirm' :confirmColor="remark?'#2979ff':'#ccc'"
  211. showCancelButton='true' title="备注">
  212. <view class="slot-content">
  213. <u--textarea v-model="remark" placeholder="输入备注,不超过150个字"></u--textarea>
  214. </view>
  215. </u-modal>
  216. <view v-if='qrcodeShow' class="shade">
  217. <view class='qrCode'>
  218. <view style='text-align:right;'>
  219. <uni-icons @click='qrcodeShow=false' type="close" size="20"></uni-icons>
  220. </view>
  221. <image :src="currectData.qrCode" mode=""></image>
  222. </view>
  223. </view>
  224. <u-popup :show="popupshow" mode="bottom">
  225. <view>
  226. <view class="share-to">
  227. <text>分享到</text>
  228. </view>
  229. <view class="content">
  230. <view class="block" @click="toUrl()">
  231. <button class="moment">
  232. <text class="iconfont icon-weixin"></text>
  233. <!-- <image src="/static/img/moment.png" mode="aspectFill"></image> -->
  234. <text>扫码分享</text>
  235. </button>
  236. </view>
  237. <view class="block">
  238. <button class="shareBtn" type="default" data-name="shareBtn" open-type="share"> 分享</button>
  239. </view>
  240. </view>
  241. <view class="cancel" @click.stop="handleHiddenShare">
  242. <text>取消</text>
  243. </view>
  244. </view>
  245. </u-popup>
  246. <!-- <image :src="poster" style="width: 750rpx;height: 1334rpx;"></image> -->
  247. <!-- 生成图片 -->
  248. <poster :list="canvasData" background-color="#FFF"
  249. :width='750' :height='420'
  250. @on-success="posterSuccess" ref="poster" @on-error="posterError"></poster>
  251. </view>
  252. </template>
  253. <script>
  254. import Poster from '../../components/zhangyuhao-poster/Poster.vue'
  255. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  256. export default {
  257. mixins: [MescrollMixin],
  258. components: {
  259. Poster
  260. },
  261. data() {
  262. return {
  263. canReset: false,
  264. poster: '',
  265. canvasData: [],
  266. searchVal: '',
  267. isShowType: false,
  268. loading: true,
  269. typeName: '',
  270. typeColumns: [],
  271. cardHolderList: [],
  272. currectData: [],
  273. type: 1,
  274. popupshow: false,
  275. modalShow: false,
  276. remark: '',
  277. islongPress: false,
  278. checked: false,
  279. checkedList: [],
  280. delShow: false,
  281. qrcodeShow: false,
  282. unread: 0,
  283. noticeList: [],
  284. };
  285. },
  286. onShow() {
  287. if (uni.getStorageSync("userInfo")) {
  288. this.userInfo = uni.getStorageSync("userInfo")
  289. this.$nextTick(function() {
  290. this.canReset && this.mescroll.resetUpScroll() // 重置列表数据为第一页
  291. this.canReset && this.mescroll.scrollTo(0, 0) // 重置列表数据为第一页时,建议把滚动条也重置到顶部,避免无法再次翻页的问题
  292. this.canReset = true // 过滤第一次的onShow事件,避免初始化界面时重复触发upCallback, 无需配置auto:false
  293. });
  294. } else {
  295. this.login()
  296. }
  297. this.searchVal = uni.getStorageSync("search_val") ? uni.getStorageSync("search_val") : ''
  298. },
  299. mounted() {
  300. },
  301. onLoad: function() {
  302. wx.showShareMenu({
  303. withShareTicket: true,
  304. menus: ["shareAppMessage", "shareTimeline"]
  305. })
  306. },
  307. onShareAppMessage(res) {
  308. console.log(1111)
  309. let that = this;
  310. //生成名片图片
  311. let imageUrl = this.poster
  312. console.log("imageUrl", imageUrl)
  313. if (res.from === 'button') {
  314. let path = `/pages/cardHolder/scanCodeAddCard?id=${that.currectData.id}`
  315. return {
  316. title: `${that.currectData.name}分享的名片~`,
  317. path: path,
  318. imageUrl: imageUrl,
  319. };
  320. }
  321. if (res.from === 'menu') {
  322. return {
  323. title: '商通线上商城',
  324. path: '/pages/tabBarPro/index/index',
  325. imageUrl: imageUrl
  326. };
  327. }
  328. },
  329. // 分享到朋友圈
  330. onShareTimeline() {
  331. return {
  332. title: '商通线上商城',
  333. path: '/pages/index/index',
  334. imageUrl: 'https://cdn.uviewui.com/uview/swiper/1.jpg'
  335. };
  336. },
  337. methods: {
  338. delVal(){
  339. this.searchVal =""
  340. this.mescroll.resetUpScroll()
  341. },
  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>