cardHolder.vue 36 KB

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