scanCodeAddCard.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. <template>
  2. <view>
  3. <view class="card-wrap">
  4. <card :obj="cardInfo" :styleList="bottomStyle" page="scanCodeAddCard"></card>
  5. <view class="row-text">
  6. <text>默</text>
  7. </view>
  8. </view>
  9. <!-- <view class="content1">
  10. <view class="left">
  11. </view>
  12. <view class="right">
  13. <view class="row1">
  14. {{cardInfo.name}}|{{cardInfo.post}}
  15. </view>
  16. <view class="">
  17. {{cardInfo.companyName}}
  18. </view>
  19. <view class="">
  20. 地址{{cardInfo.province}}{{cardInfo.city}}{{cardInfo.area}}{{cardInfo.detailedAddress}}
  21. </view>
  22. <view class="">
  23. 联系电话{{cardInfo.phone}}
  24. </view>
  25. <view class="">
  26. 备注{{cardInfo.remark?cardInfo.remark:''}}
  27. </view>
  28. </view>
  29. </view> -->
  30. <view class="title">
  31. 名片信息
  32. </view>
  33. <view class="form-style">
  34. <view class="row" style="border-bottom: 1px solid #E6E5E5;padding-bottom: 20rpx;">
  35. <view class="left">
  36. 名片分类
  37. </view>
  38. <view class="right" @click="show = true">
  39. {{cardInfo.classify?cardInfo.classify:'默认分类'}}
  40. </view>
  41. </view>
  42. <view class="" style="padding: 20rpx 0;">
  43. <view class="left" style="margin-bottom: 20rpx;">
  44. 备注(选填)
  45. </view>
  46. <view class="right">
  47. <u--textarea v-model="cardInfo.remark" placeholder="输入备注,不超过150个字 "></u--textarea>
  48. </view>
  49. </view>
  50. <view v-if='commonId' class="flex flex-between" style="border-bottom: 1px solid #E6E5E5;padding: 20rpx 0;">
  51. <view class="left">
  52. 我的名片
  53. </view>
  54. <view class="right" @click="show1 = true">
  55. {{cardInfo.cardBusiness?cardInfo.cardBusiness:'无名片'}}
  56. </view>
  57. </view>
  58. </view>
  59. <u-picker keyName="cardBusiness" title="选择名片" @close="show1=false" @cancel="show1=false" closeOnClickOverlay
  60. @confirm="cardConfirm" :show="show1" :columns="cardList"></u-picker>
  61. <u-picker keyName="circleName" title="选择分类" @close="show=false" @cancel="show=false" closeOnClickOverlay
  62. @confirm="typeConfirm" :show="show" :columns="columns"></u-picker>
  63. <view class="bottom-btn">
  64. <u-button @click='cancel' text="取消" type="primary" :plain="true" color="#18254C" :customStyle="btnStyle"></u-button>
  65. <u-button @click='$u.debounce(save, 500)' text="保存" type="primary" color="#18254C" :customStyle="btnStyle"></u-button>
  66. </view>
  67. <u-toast ref="uToast"></u-toast>
  68. </view>
  69. </template>
  70. <script>
  71. import Card from '../../components/Card/Card.vue'
  72. export default {
  73. components: {
  74. Card
  75. },
  76. data() {
  77. return {
  78. btnStyle:{
  79. // width:'calc(50% - 80rpx)'
  80. },
  81. bottomStyle: [
  82. "position:absolute;left: 0;width:24vw;height:0;border-bottom:80rpx solid red;border-right:80rpx solid transparent;border-radius:0 0 0 20rpx",
  83. "position: absolute;right: -40rpx;width: 58vw;height: 0;border-top: 80rpx solid green;border-left: 80rpx solid transparent;border-radius: 0 0 10px 0"
  84. ],
  85. id: '',
  86. commonId:'',
  87. cardInfo: {},
  88. show: false,
  89. show1: false,
  90. columns: [],
  91. cardList: [],
  92. rules: {
  93. 'userInfo.name': {
  94. type: 'string',
  95. required: true,
  96. message: '请填写姓名',
  97. trigger: ['blur', 'change']
  98. },
  99. 'userInfo.sex': {
  100. type: 'string',
  101. max: 1,
  102. required: true,
  103. message: '请选择男或女',
  104. trigger: ['blur', 'change']
  105. },
  106. },
  107. }
  108. },
  109. onLoad(options) {
  110. this.id = options.id.indexOf(",") ? options.id.split(",")[0] : options.id
  111. this.commonId=options.id.indexOf(",") ? options.id.split(",")[1] :''
  112. this.getList()
  113. },
  114. onShow() {
  115. },
  116. methods: {
  117. save() {
  118. uni.showLoading({
  119. title: '数据加载中',
  120. mask: true
  121. })
  122. this.$request.baseRequest('admin.unimall.cardHolderInfo', 'add', {
  123. cardHolderInfo: JSON.stringify({
  124. cardId: this.cardInfo.id,
  125. remark: this.cardInfo.remark,
  126. cardCommonId: this.cardInfo.cardCommonId,
  127. myCardId: this.cardInfo.myCardId,
  128. commonId: uni.getStorageSync("userInfo").id,
  129. classify: this.cardInfo.classify
  130. })
  131. }, failres => {
  132. this.$refs.uToast.show({
  133. type: 'error',
  134. message: failres.errmsg,
  135. })
  136. uni.hideLoading()
  137. }).then(res => {
  138. this.$refs.uToast.show({
  139. type: 'success',
  140. message: '保存成功!',
  141. })
  142. uni.switchTab({
  143. url: "/pages/cardHolder/cardHolder"
  144. })
  145. })
  146. },
  147. cancel() {
  148. uni.switchTab({
  149. url: "/pages/cardHolder/cardHolder"
  150. })
  151. },
  152. cardConfirm(e) {
  153. console.log(e)
  154. this.cardInfo.cardBusiness = e.value[0].cardBusiness
  155. this.cardInfo.myCardId = e.value[0].id
  156. this.show1 = false
  157. },
  158. typeConfirm(e) {
  159. console.log(e)
  160. this.cardInfo.classify = e.value[0].circleName
  161. this.show = false
  162. },
  163. getList() {
  164. this.$request.baseRequest('admin.unimall.cardManagementInfo', 'get', {
  165. id: this.id
  166. }, failres => {
  167. console.log('res+++++', failres.errmsg)
  168. this.$refs.uToast.show({
  169. type: 'error',
  170. message: failres.errmsg,
  171. })
  172. uni.hideLoading()
  173. }).then(res => {
  174. this.cardInfo = res.data
  175. this.cardInfo.cardBusiness=''
  176. this.cardInfo.cardCommonId = res.data.commonId
  177. console.log(res)
  178. })
  179. console.log(uni.getStorageSync("userInfo").id,111111)
  180. this.$request.baseRequest('admin.unimall.cardManagementInfo', 'list', {
  181. commonId: uni.getStorageSync("userInfo").id
  182. }, failres => {
  183. this.$refs.uToast.show({
  184. type: 'error',
  185. message: failres.errmsg,
  186. })
  187. uni.hideLoading()
  188. }).then(res => {
  189. this.cardList = [res.data.items]
  190. })
  191. this.$request.baseRequest('admin.unimall.cardClassifyInfo', 'list', {
  192. page: 1,
  193. limit: 9999,
  194. commonId: uni.getStorageSync("userInfo").id
  195. }, failres => {
  196. console.log('res+++++', failres.errmsg)
  197. this.$refs.uToast.show({
  198. type: 'error',
  199. message: failres.errmsg,
  200. })
  201. }).then(res => {
  202. this.columns = [res.data.items]
  203. console.log(this.columns)
  204. })
  205. }
  206. }
  207. }
  208. </script>
  209. <style scoped lang="scss">
  210. .card-wrap {
  211. position: relative;
  212. .row-text {
  213. position: absolute;
  214. bottom: 20px;
  215. left: 110rpx;
  216. }
  217. }
  218. .title{
  219. font-size: 32rpx;
  220. font-weight: bold;
  221. color: #19191A;
  222. margin-left: 20rpx;
  223. }
  224. .form-style{
  225. background: #fff;
  226. padding: 20rpx;
  227. margin: 20rpx;
  228. box-sizing: border-box;
  229. border-radius: 20rpx;
  230. .row{
  231. display: flex;
  232. justify-content: space-between;
  233. }
  234. }
  235. .bottom-btn{
  236. position: fixed;
  237. bottom: 40rpx;
  238. display: flex;
  239. justify-content: space-between;
  240. // padding: 20rpx;
  241. width: 100vw;
  242. }
  243. </style>