scanCodeAddCard.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613
  1. <template>
  2. <view>
  3. <view class="card-wrap">
  4. <!-- <card :obj="cardInfo" :styleList="bottomStyle" page="scanCodeAddCard"></card> -->
  5. <view class="card-list-cardInfo relative"
  6. :style="cardInfo.currentBackground?'background: url('+cardInfo.currentBackground+');background-size:100% 100%':''">
  7. <view class="card-content style1" v-if="cardInfo.cuttentTemplate==1">
  8. <view class="left">
  9. <u--image :showLoading="true" :src="cardInfo.headSculpture" width="66px" height="66px"
  10. shape="circle"></u--image>
  11. </view>
  12. <view class="right">
  13. <view class="row1">
  14. <text class="name">{{cardInfo.name}}</text>
  15. <text class="post">{{cardInfo.post}}</text>
  16. </view>
  17. <view class="row2">
  18. {{cardInfo.companyName}}
  19. </view>
  20. <view class="row3 flex" @click="toMap(cardInfo)">
  21. <u--image :showLoading="true" :src="'/static/imgs/card/address'+cardInfo.icon+'.png'"
  22. width="13px" height="16px"></u--image>
  23. <view class='icon-text'>{{ cardInfo.province }}{{ cardInfo.city }}{{ cardInfo.area }}</view>
  24. </view>
  25. <view @click="freeTell(cardInfo)" class="row4 flex">
  26. <u--image :showLoading="true" :src="'/static/imgs/card/phone'+cardInfo.icon+'.png'"
  27. width="12px" height="13px"></u--image>
  28. <view class='icon-text'>{{ cardInfo.phone }}</view>
  29. </view>
  30. <view class="row2 flex" style="color: #808080">
  31. <u--image :showLoading="true" :src="'/static/imgs/card/remark'+cardInfo.icon+'.png'"
  32. width="10px" height="12px"></u--image>
  33. <view class='icon-text' style="color: #808080;">{{cardInfo.remark?cardInfo.remark:''}}
  34. </view>
  35. </view>
  36. </view>
  37. <u-checkbox-group v-if='islongPress' placement="column" @change="checkboxChange($event,index)">
  38. <u-checkbox iconColor='#4977FC' activeColor="#fff" :name='index+1' :checked='cardInfo.checked'
  39. :customStyle="{marginBottom: '8px'}">
  40. </u-checkbox>
  41. </u-checkbox-group>
  42. </view>
  43. <view class="card-content style1 flex-between" v-if="cardInfo.cuttentTemplate==2">
  44. <view class="right">
  45. <view class="row1">
  46. <text class="name">{{cardInfo.name}}</text>
  47. <text class="post">{{cardInfo.post}}</text>
  48. </view>
  49. <view class="row2">
  50. {{cardInfo.companyName}}
  51. </view>
  52. <view @click="toMap(cardInfo)" class="row3 flex">
  53. <u--image :showLoading="true" :src="'/static/imgs/card/address'+cardInfo.icon+'.png'"
  54. width="13px" height="16px"></u--image>
  55. <view class='icon-text'>{{ cardInfo.province }}{{ cardInfo.city }}{{ cardInfo.area }}</view>
  56. </view>
  57. <view @click="freeTell(cardInfo)" class="row4 flex">
  58. <u--image :showLoading="true" :src="'/static/imgs/card/phone'+cardInfo.icon+'.png'"
  59. width="12px" height="13px"></u--image>
  60. <view class='icon-text'>{{ cardInfo.phone }}</view>
  61. </view>
  62. <view class="row2 flex" style="color: #808080">
  63. <u--image :showLoading="true" :src="'/static/imgs/card/remark'+cardInfo.icon+'.png'"
  64. width="10px" height="12px"></u--image>
  65. <view class='icon-text' style="color: #808080;">{{cardInfo.remark?cardInfo.remark:''}}
  66. </view>
  67. </view>
  68. </view>
  69. <view class="left">
  70. <u--image :showLoading="true" :src="cardInfo.headSculpture" width="66px" height="66px"
  71. shape="circle" v-if="cardInfo.headSculpture"></u--image>
  72. <u--image :showLoading="true" src="/static/imgs/card/defaulthead.png" width="66px" height="66px"
  73. shape="circle" v-else></u--image>
  74. </view>
  75. <u-checkbox-group v-if='islongPress' placement="column" @change="checkboxChange($event,index)">
  76. <u-checkbox iconColor='#4977FC' activeColor="#fff" :name='index+1' :checked='cardInfo.checked'
  77. :customStyle="{marginBottom: '8px'}">
  78. </u-checkbox>
  79. </u-checkbox-group>
  80. </view>
  81. <view class="card-content style2" v-if="cardInfo.cuttentTemplate==3">
  82. <view class="top">
  83. <u--image :showLoading="true" :src="cardInfo.headSculpture" width="66px" height="66px"
  84. shape="circle" v-if="cardInfo.headSculpture"></u--image>
  85. <u--image :showLoading="true" src="/static/imgs/card/defaulthead.png" width="66px" height="66px"
  86. shape="circle" v-else></u--image>
  87. </view>
  88. <view class="bottom flex">
  89. <view class="left">
  90. <view class="row1">
  91. <text class="name">{{cardInfo.name}}</text>
  92. <text class="post">{{cardInfo.post}}</text>
  93. </view>
  94. <view class="row2">
  95. {{cardInfo.companyName}}
  96. </view>
  97. </view>
  98. <view class="right">
  99. <view @click="toMap(cardInfo)" class="row1 flex">
  100. <u--image :showLoading="true" :src="'/static/imgs/card/address'+cardInfo.icon+'.png'"
  101. width="13px" height="16px"></u--image>
  102. <view class='icon-text'>{{ cardInfo.province }}{{ cardInfo.city }}{{ cardInfo.area }}
  103. </view>
  104. </view>
  105. <view @click="freeTell(cardInfo)" class="row2 flex">
  106. <u--image :showLoading="true" :src="'/static/imgs/card/phone'+cardInfo.icon+'.png'"
  107. width="12px" height="13px"></u--image>
  108. <view class='icon-text'>{{ cardInfo.phone }}</view>
  109. </view>
  110. <view class="row2 flex" style="color: #808080">
  111. <u--image :showLoading="true" :src="'/static/imgs/card/remark'+cardInfo.icon+'.png'"
  112. width="10px" height="12px"></u--image>
  113. <view class='icon-text' style="color: #808080;">
  114. {{cardInfo.remark?cardInfo.remark:''}}
  115. </view>
  116. </view>
  117. </view>
  118. </view>
  119. <u-checkbox-group v-if='islongPress' placement="column" @change="checkboxChange($event,index)">
  120. <u-checkbox iconColor='#4977FC' activeColor="#fff" :name='index+1' :checked='cardInfo.checked'
  121. :customStyle="{marginBottom: '8px'}">
  122. </u-checkbox>
  123. </u-checkbox-group>
  124. </view>
  125. <view class="card-content style2" v-if="cardInfo.cuttentTemplate==4">
  126. <view class="top">
  127. <view class="row1">
  128. <text class="name">{{cardInfo.name}}</text>
  129. <text class="post">{{cardInfo.post}}</text>
  130. </view>
  131. <view class="row2">
  132. {{cardInfo.companyName}}
  133. </view>
  134. </view>
  135. <view class="bottom flex">
  136. <view class="left">
  137. <u--image :showLoading="true" :src="cardInfo.headSculpture" width="66px" height="66px"
  138. shape="circle" v-if="cardInfo.headSculpture"></u--image>
  139. <u--image :showLoading="true" src="/static/imgs/card/defaulthead.png" width="66px"
  140. height="66px" shape="circle" v-else></u--image>
  141. </view>
  142. <view class="right">
  143. <view @click="toMap(cardInfo)" class="row1 flex">
  144. <u--image :showLoading="true" :src="'/static/imgs/card/address'+cardInfo.icon+'.png'"
  145. width="13px" height="16px"></u--image>
  146. <view class='icon-text'>{{ cardInfo.province }}{{ cardInfo.city }}{{ cardInfo.area }}
  147. </view>
  148. </view>
  149. <view @click="freeTell(cardInfo)" class="row2 flex">
  150. <u--image :showLoading="true" :src="'/static/imgs/card/phone'+cardInfo.icon+'.png'"
  151. width="12px" height="13px"></u--image>
  152. <view class='icon-text'>{{ cardInfo.phone }}</view>
  153. </view>
  154. <view class="row2 flex" style="color: #808080">
  155. <u--image :showLoading="true" :src="'/static/imgs/card/remark'+cardInfo.icon+'.png'"
  156. width="10px" height="12px"></u--image>
  157. <view :style='cardInfo.remark?"color:#000;":"color:#808080;"' class='icon-text'>
  158. {{cardInfo.remark?cardInfo.remark:''}}
  159. </view>
  160. </view>
  161. </view>
  162. </view>
  163. <u-checkbox-group v-if='islongPress' placement="column" @change="checkboxChange($event,index)">
  164. <u-checkbox iconColor='#4977FC' activeColor="#fff" :name='index+1' :checked='cardInfo.checked'
  165. :customStyle="{marginBottom: '8px'}">
  166. </u-checkbox>
  167. </u-checkbox-group>
  168. </view>
  169. <view class="car-bottom flex">
  170. <text style="color: #fff;font-size: 36rpx;font-weight: 700;margin-left: 40rpx;">{{value?value:'默'}}</text>
  171. </view>
  172. </view>
  173. </view>
  174. <view class="title">
  175. 名片信息
  176. </view>
  177. <view class="form-style">
  178. <view class="row" style="border-bottom: 1px solid #E6E5E5;padding-bottom: 20rpx;">
  179. <view class="left">
  180. 名片分类
  181. </view>
  182. <view class="right" @click="show = true">
  183. {{cardInfo.classify?cardInfo.classify:'默认分类'}}
  184. </view>
  185. </view>
  186. <view class="" style="padding: 20rpx 0;">
  187. <view class="left" style="margin-bottom: 20rpx;">
  188. 备注(选填)
  189. </view>
  190. <view class="right">
  191. <u--textarea v-model="cardInfo.remark" placeholder="输入备注,不超过150个字 "></u--textarea>
  192. </view>
  193. </view>
  194. <view v-if='commonId' class="flex flex-between" style="border-bottom: 1px solid #E6E5E5;padding: 20rpx 0;">
  195. <view class="left">
  196. 我的名片
  197. </view>
  198. <view class="right" @click="show1 = true">
  199. {{cardInfo.cardBusiness?cardInfo.cardBusiness:'无名片'}}
  200. </view>
  201. </view>
  202. </view>
  203. <u-picker :immediateChange="true" keyName="cardBusiness" title="选择名片" @close="show1=false" @cancel="show1=false"
  204. closeOnClickOverlay @confirm="cardConfirm" :show="show1" :columns="cardList"></u-picker>
  205. <u-picker :immediateChange="true" keyName="circleName" title="选择分类" @close="show=false" @cancel="show=false"
  206. closeOnClickOverlay @confirm="typeConfirm" :show="show" :columns="columns"></u-picker>
  207. <view class="bottom-btn">
  208. <u-button @click='cancel' text="取消" type="primary" :plain="true" color="#18254C"
  209. :customStyle="btnStyle"></u-button>
  210. <u-button @click='$u.debounce(save, 500)' text="保存" type="primary" color="#18254C"
  211. :customStyle="btnStyle"></u-button>
  212. </view>
  213. <u-toast ref="uToast"></u-toast>
  214. </view>
  215. </template>
  216. <script>
  217. import Card from '../../components/Card/Card.vue'
  218. export default {
  219. components: {
  220. Card
  221. },
  222. data() {
  223. return {
  224. value: '',
  225. btnStyle: {
  226. width:'calc(50% - 80rpx)'
  227. },
  228. bottomStyle: [
  229. "position:absolute;left: 0;width:24vw;height:0;border-bottom:80rpx solid red;border-right:80rpx solid transparent;border-radius:0 0 0 20rpx",
  230. "position: absolute;right: -40rpx;width: 58vw;height: 0;border-top: 80rpx solid green;border-left: 80rpx solid transparent;border-radius: 0 0 10px 0"
  231. ],
  232. id: '',
  233. commonId: '',
  234. cardInfo: {},
  235. show: false,
  236. show1: false,
  237. columns: [],
  238. cardList: [],
  239. rules: {
  240. 'userInfo.name': {
  241. type: 'string',
  242. required: true,
  243. message: '请填写姓名',
  244. trigger: ['blur', 'change']
  245. },
  246. 'userInfo.sex': {
  247. type: 'string',
  248. max: 1,
  249. required: true,
  250. message: '请选择男或女',
  251. trigger: ['blur', 'change']
  252. },
  253. },
  254. }
  255. },
  256. onLoad(options) {
  257. console.log(123)
  258. this.id = options.id.indexOf(",") ? options.id.split(",")[0] : options.id
  259. this.commonId = options.id.indexOf(",") ? options.id.split(",")[1] : ''
  260. this.getList()
  261. },
  262. onShow() {
  263. },
  264. methods: {
  265. save() {
  266. uni.showLoading({
  267. title: '数据加载中',
  268. mask: true
  269. })
  270. this.$request.baseRequest('admin.unimall.cardHolderInfo', 'add', {
  271. cardHolderInfo: JSON.stringify({
  272. cardId: this.cardInfo.id,
  273. remark: this.cardInfo.remark,
  274. cardCommonId: this.commonId,
  275. myCardId: this.cardInfo.myCardId,
  276. commonId: uni.getStorageSync("userInfo").id,
  277. classify: this.cardInfo.classify
  278. })
  279. }, failres => {
  280. uni.showToast({
  281. icon: "none",
  282. title: failres.errmsg,
  283. duration: 3000
  284. });
  285. uni.hideLoading()
  286. }).then(res => {
  287. uni.showToast({
  288. icon: "success",
  289. title: '保存成功!',
  290. duration: 2000
  291. });
  292. uni.setStorageSync("scanAddCardToIndex",1)
  293. uni.switchTab({
  294. url: "/pages/cardHolder/cardHolder"
  295. })
  296. })
  297. },
  298. cancel() {
  299. uni.switchTab({
  300. url: "/pages/cardHolder/cardHolder"
  301. })
  302. },
  303. cardConfirm(e) {
  304. console.log(e)
  305. this.cardInfo.cardBusiness = e.value[0].cardBusiness
  306. this.cardInfo.myCardId = e.value[0].id
  307. this.show1 = false
  308. },
  309. typeConfirm(e) {
  310. console.log(e)
  311. this.cardInfo.classify = e.value[0].circleName
  312. this.value = e.value[0].circleName.substring(0,1)
  313. this.show = false
  314. },
  315. getList() {
  316. this.$request.baseRequest('admin.unimall.cardManagementInfo', 'get', {
  317. id: this.id
  318. }, failres => {
  319. console.log('res+++++', failres.errmsg)
  320. uni.showToast({
  321. icon: "none",
  322. title: failres.errmsg,
  323. duration: 3000
  324. });
  325. uni.hideLoading()
  326. }).then(res => {
  327. console.log(res, "this.cardInfo")
  328. this.cardInfo = res.data
  329. // this.cardInfo.cardBusiness = ''
  330. // this.cardInfo.cardCommonId = res.data.commonId
  331. console.log(res)
  332. })
  333. console.log(uni.getStorageSync("userInfo").id, 111111)
  334. this.$request.baseRequest('admin.unimall.cardManagementInfo', 'list', {
  335. commonId: uni.getStorageSync("userInfo").id
  336. }, failres => {
  337. uni.showToast({
  338. icon: "none",
  339. title: failres.errmsg,
  340. duration: 3000
  341. });
  342. uni.hideLoading()
  343. }).then(res => {
  344. this.cardList = [res.data.items]
  345. this.cardInfo.cardBusiness = res.data.items[0].cardBusiness
  346. this.cardInfo.myCardId = res.data.items[0].id
  347. })
  348. this.$request.baseRequest('admin.unimall.cardClassifyInfo', 'list', {
  349. page: 1,
  350. limit: 9999,
  351. commonId: uni.getStorageSync("userInfo").id
  352. }, failres => {
  353. console.log('res+++++', failres.errmsg)
  354. uni.showToast({
  355. icon: "none",
  356. title: failres.errmsg,
  357. duration: 3000
  358. });
  359. }).then(res => {
  360. this.columns = [res.data.items]
  361. console.log(this.columns)
  362. })
  363. }
  364. }
  365. }
  366. </script>
  367. <style scoped lang="scss">
  368. .card-wrap {
  369. margin: 0 20rpx;
  370. background: #f5f5f5;
  371. // height: 1000px;
  372. border-radius: 30rpx;
  373. .style1 {
  374. display: flex;
  375. padding: 20rpx 30rpx;
  376. width: 85%;
  377. margin-bottom: 90rpx;
  378. .left {
  379. width: 132rpx;
  380. height: 132rpx;
  381. border-radius: 50%;
  382. }
  383. .right {
  384. margin-left: 40rpx;
  385. .row1 {
  386. .name {
  387. font-size: 38rpx;
  388. font-weight: bold;
  389. color: #040000;
  390. margin-right: 20rpx;
  391. }
  392. .post {
  393. font-size: 26rpx;
  394. font-weight: 500;
  395. color: #666666;
  396. }
  397. }
  398. .row2 {
  399. font-size: 24rpx;
  400. font-weight: bold;
  401. color: #323333;
  402. }
  403. .row3 {
  404. margin-top: 30rpx;
  405. font-size: 24rpx;
  406. font-weight: 500;
  407. color: #323333;
  408. }
  409. .row2,
  410. .row4 {
  411. margin-top: 10rpx;
  412. }
  413. }
  414. }
  415. .style2 {
  416. padding: 15rpx;
  417. margin-bottom: 80rpx;
  418. .top {
  419. .row1 {
  420. .name {
  421. font-size: 38rpx;
  422. font-weight: bold;
  423. color: #040000;
  424. margin-right: 20rpx;
  425. }
  426. .post {
  427. font-size: 26rpx;
  428. font-weight: 500;
  429. color: #666666;
  430. }
  431. }
  432. .row2 {
  433. margin-top: 10rpx;
  434. font-size: 24rpx;
  435. font-weight: bold;
  436. color: #323333;
  437. }
  438. }
  439. .bottom {
  440. margin-top: 20rpx;
  441. .left {
  442. margin-right: 40rpx;
  443. .row1 {
  444. .name {
  445. font-size: 38rpx;
  446. font-weight: bold;
  447. color: #040000;
  448. margin-right: 20rpx;
  449. }
  450. .post {
  451. font-size: 26rpx;
  452. font-weight: 500;
  453. color: #666666;
  454. }
  455. }
  456. .row2 {
  457. margin-top: 10rpx;
  458. font-size: 26rpx;
  459. font-weight: bold;
  460. color: #323333;
  461. }
  462. }
  463. .right {
  464. .row1,
  465. .row2 {
  466. font-size: 24rpx;
  467. font-weight: 500;
  468. color: #323333;
  469. }
  470. .row2,
  471. .row4 {
  472. margin-top: 10rpx;
  473. }
  474. }
  475. }
  476. }
  477. }
  478. .car-bottom {
  479. position: absolute;
  480. bottom: 63rpx;
  481. left: 20rpx;
  482. bottom: 24rpx;
  483. width: 94.9%;
  484. background: url("../../static/imgs/card/bgc4.png") no-repeat center;
  485. background-size: cover;
  486. height: 80rpx;
  487. // width: calc(100% - 40rpx);
  488. .left {
  489. // top: -40rpx;
  490. position: absolute;
  491. padding: 20rpx 0;
  492. width: 70vw;
  493. height: 80rpx;
  494. box-sizing: border-box;
  495. display: flex;
  496. align-items: center;
  497. justify-content: space-evenly;
  498. left: 0px;
  499. // background-size: 100% 100%;
  500. overflow-y: hidden;
  501. }
  502. }
  503. .card-list-item {
  504. width: calc(100%);
  505. // left:-20rpx;
  506. position: relative;
  507. border-radius: 30rpx;
  508. padding: 40rpx;
  509. box-sizing: border-box;
  510. .left {
  511. width: 30%;
  512. .top {
  513. margin-bottom: 20rpx;
  514. }
  515. .img {
  516. width: 80%;
  517. }
  518. .bottom {}
  519. }
  520. .right {
  521. .row1 {
  522. .line {
  523. width: 1px;
  524. height: 20px;
  525. margin: 0 20rpx;
  526. background: black;
  527. }
  528. }
  529. }
  530. }
  531. .title {
  532. font-size: 32rpx;
  533. font-weight: bold;
  534. color: #19191A;
  535. margin-left: 20rpx;
  536. }
  537. .form-style {
  538. background: #fff;
  539. padding: 20rpx;
  540. margin: 20rpx;
  541. box-sizing: border-box;
  542. border-radius: 20rpx;
  543. .row {
  544. display: flex;
  545. justify-content: space-between;
  546. }
  547. }
  548. .bottom-btn {
  549. position: fixed;
  550. bottom: 40rpx;
  551. display: flex;
  552. justify-content: space-between;
  553. // padding: 20rpx;
  554. width: 100vw;
  555. height: auto;
  556. }
  557. .card-list-cardInfo {
  558. padding: 40rpx;
  559. }
  560. .icon-text{
  561. margin-left: 20rpx;
  562. }
  563. </style>