cardHolder.vue 32 KB

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