scanCodeAddCard.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  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 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. cardInfo: {},
  87. show: false,
  88. show1: false,
  89. columns: [],
  90. cardList: [],
  91. rules: {
  92. 'userInfo.name': {
  93. type: 'string',
  94. required: true,
  95. message: '请填写姓名',
  96. trigger: ['blur', 'change']
  97. },
  98. 'userInfo.sex': {
  99. type: 'string',
  100. max: 1,
  101. required: true,
  102. message: '请选择男或女',
  103. trigger: ['blur', 'change']
  104. },
  105. },
  106. }
  107. },
  108. onLoad(options) {
  109. this.id = options.id.indexOf(",") ? options.id.split(",")[0] : options.id
  110. this.getList()
  111. },
  112. onShow() {
  113. },
  114. methods: {
  115. save() {
  116. uni.showLoading({
  117. title: '数据加载中',
  118. mask: true
  119. })
  120. this.$request.baseRequest('admin.unimall.cardHolderInfo', 'add', {
  121. cardHolderInfo: JSON.stringify({
  122. cardId: this.cardInfo.id,
  123. remark: this.cardInfo.remark,
  124. cardCommonId: this.cardInfo.cardCommonId,
  125. myCardId: this.cardInfo.myCardId,
  126. commonId: uni.getStorageSync("userInfo").id,
  127. classify: this.cardInfo.classify
  128. })
  129. }, failres => {
  130. this.$refs.uToast.show({
  131. type: 'error',
  132. message: failres.errmsg,
  133. })
  134. uni.hideLoading()
  135. }).then(res => {
  136. this.$refs.uToast.show({
  137. type: 'success',
  138. message: '保存成功!',
  139. })
  140. uni.switchTab({
  141. url: "/pages/cardHolder/cardHolder"
  142. })
  143. })
  144. },
  145. cancel() {
  146. uni.switchTab({
  147. url: "/pages/cardHolder/cardHolder"
  148. })
  149. },
  150. cardConfirm(e) {
  151. console.log(e)
  152. this.cardInfo.cardBusiness = e.value[0].cardBusiness
  153. this.cardInfo.myCardId = e.value[0].id
  154. this.show1 = false
  155. },
  156. typeConfirm(e) {
  157. console.log(e)
  158. this.cardInfo.classify = e.value[0].circleName
  159. this.show = false
  160. },
  161. getList() {
  162. this.$request.baseRequest('admin.unimall.cardManagementInfo', 'list', {
  163. commonId: uni.getStorageSync("userInfo").id
  164. }, failres => {
  165. this.$refs.uToast.show({
  166. type: 'error',
  167. message: failres.errmsg,
  168. })
  169. uni.hideLoading()
  170. }).then(res => {
  171. this.cardList = [res.data.items]
  172. })
  173. this.$request.baseRequest('admin.unimall.cardClassifyInfo', 'list', {
  174. page: 1,
  175. limit: 9999,
  176. commonId: uni.getStorageSync("userInfo").id
  177. }, failres => {
  178. console.log('res+++++', failres.errmsg)
  179. this.$refs.uToast.show({
  180. type: 'error',
  181. message: failres.errmsg,
  182. })
  183. }).then(res => {
  184. this.columns = [res.data.items]
  185. console.log(this.columns)
  186. })
  187. this.$request.baseRequest('admin.unimall.cardManagementInfo', 'get', {
  188. id: this.id
  189. }, failres => {
  190. console.log('res+++++', failres.errmsg)
  191. this.$refs.uToast.show({
  192. type: 'error',
  193. message: failres.errmsg,
  194. })
  195. uni.hideLoading()
  196. }).then(res => {
  197. this.cardInfo = res.data
  198. this.cardInfo.cardCommonId = res.data.commonId
  199. console.log(res)
  200. })
  201. }
  202. }
  203. }
  204. </script>
  205. <style scoped lang="scss">
  206. .card-wrap {
  207. position: relative;
  208. .row-text {
  209. position: absolute;
  210. bottom: 20px;
  211. left: 110rpx;
  212. }
  213. }
  214. .title{
  215. font-size: 32rpx;
  216. font-weight: bold;
  217. color: #19191A;
  218. margin-left: 20rpx;
  219. }
  220. .form-style{
  221. background: #fff;
  222. padding: 20rpx;
  223. margin: 20rpx;
  224. box-sizing: border-box;
  225. border-radius: 20rpx;
  226. .row{
  227. display: flex;
  228. justify-content: space-between;
  229. }
  230. }
  231. .bottom-btn{
  232. position: fixed;
  233. bottom: 40rpx;
  234. display: flex;
  235. justify-content: space-between;
  236. // padding: 20rpx;
  237. width: 100vw;
  238. }
  239. </style>