scanCodeAddCard.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  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. uni.showToast({
  112. icon:"none",
  113. title: failres.errmsg,
  114. duration: 3000
  115. });
  116. uni.hideLoading()
  117. }).then(res => {
  118. uni.showToast({
  119. icon:"success",
  120. title: '保存成功!',
  121. duration: 2000
  122. });
  123. uni.switchTab({
  124. url: "/pages/cardHolder/cardHolder"
  125. })
  126. })
  127. },
  128. cancel() {
  129. uni.switchTab({
  130. url: "/pages/cardHolder/cardHolder"
  131. })
  132. },
  133. cardConfirm(e) {
  134. console.log(e)
  135. this.cardInfo.cardBusiness = e.value[0].cardBusiness
  136. this.cardInfo.myCardId = e.value[0].id
  137. this.show1 = false
  138. },
  139. typeConfirm(e) {
  140. console.log(e)
  141. this.cardInfo.classify = e.value[0].circleName
  142. this.show = false
  143. },
  144. getList() {
  145. this.$request.baseRequest('admin.unimall.cardManagementInfo', 'get', {
  146. id: this.id
  147. }, failres => {
  148. console.log('res+++++', failres.errmsg)
  149. uni.showToast({
  150. icon:"none",
  151. title: failres.errmsg,
  152. duration: 3000
  153. });
  154. uni.hideLoading()
  155. }).then(res => {
  156. console.log(res,"this.cardInfo")
  157. this.cardInfo = res.data
  158. this.cardInfo.cardBusiness=''
  159. // this.cardInfo.cardCommonId = res.data.commonId
  160. console.log(res)
  161. })
  162. console.log(uni.getStorageSync("userInfo").id,111111)
  163. this.$request.baseRequest('admin.unimall.cardManagementInfo', 'list', {
  164. commonId: uni.getStorageSync("userInfo").id
  165. }, failres => {
  166. uni.showToast({
  167. icon:"none",
  168. title: failres.errmsg,
  169. duration: 3000
  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. uni.showToast({
  182. icon:"none",
  183. title: failres.errmsg,
  184. duration: 3000
  185. });
  186. }).then(res => {
  187. this.columns = [res.data.items]
  188. console.log(this.columns)
  189. })
  190. }
  191. }
  192. }
  193. </script>
  194. <style scoped lang="scss">
  195. .card-wrap {
  196. position: relative;
  197. .row-text {
  198. position: absolute;
  199. bottom: 20px;
  200. left: 110rpx;
  201. }
  202. }
  203. .title{
  204. font-size: 32rpx;
  205. font-weight: bold;
  206. color: #19191A;
  207. margin-left: 20rpx;
  208. }
  209. .form-style{
  210. background: #fff;
  211. padding: 20rpx;
  212. margin: 20rpx;
  213. box-sizing: border-box;
  214. border-radius: 20rpx;
  215. .row{
  216. display: flex;
  217. justify-content: space-between;
  218. }
  219. }
  220. .bottom-btn{
  221. position: fixed;
  222. bottom: 40rpx;
  223. display: flex;
  224. justify-content: space-between;
  225. // padding: 20rpx;
  226. width: 100vw;
  227. height: auto;
  228. }
  229. </style>