scanCodeAddCard.vue 5.9 KB

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