scanCodeAddCard.vue 6.3 KB

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