cardHolder.vue 28 KB

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