giveFamilyCard.vue 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <template>
  2. <view class="box">
  3. <u--form labelPosition="top" :model="userInfo" ref="form1">
  4. <u-form-item labelWidth="auto" labelAlign="right" label="被赠送会员编号" prop="phone">
  5. <u--input v-model="userInfo.memberNo" placeholder="请输入被赠送会员编号" border="bottom"
  6. ></u--input>
  7. </u-form-item>
  8. <u-form-item labelWidth="auto" labelAlign="right" label="被赠送会员手机号" prop="smsCode" width="120">
  9. <u--input v-model="userInfo.memberPhone" placeholder="请输入被赠送会员手机号" border="bottom"
  10. ></u--input>
  11. </u-form-item>
  12. </u--form>
  13. <view class="op-btn-wrap">
  14. <view class="h-btn" @click="handleGive">
  15. <text>确定
  16. <text class="presentCount" v-if="count !== null">(剩余可赠送{{count}}次)</text>
  17. </text>
  18. </view>
  19. </view>
  20. </view>
  21. </template>
  22. <script>
  23. export default {
  24. name: "giveFamilyCard",
  25. data() {
  26. return {
  27. userInfo: {},
  28. giveUser: {},
  29. count:null
  30. }
  31. },
  32. onShow(){
  33. this.presentCount()
  34. },
  35. methods: {
  36. handleGive() {
  37. if (this.count == 0){
  38. uni.$u.toast('可赠送次数不足!')
  39. return
  40. }
  41. this.giveUser.memberNo = "Vip." + this.userInfo.memberNo
  42. this.giveUser.memberPhone = this.userInfo.memberPhone
  43. this.$api.giveFamilyCard(this.giveUser).then((res) => {
  44. console.log(res)
  45. uni.showToast({
  46. duration: 2000,
  47. title: '赠送成功'
  48. });
  49. uni.navigateBack({delta : 1})
  50. }
  51. )
  52. },
  53. presentCount(){
  54. this.$api.presentCount().then(res=>{
  55. this.count = res.data.data
  56. })
  57. }
  58. }
  59. }
  60. </script>
  61. <style scoped>
  62. .box {
  63. padding: 24rpx 32rpx;
  64. }
  65. .h-btn {
  66. margin: 48rpx auto;
  67. text-align: center;
  68. width: 80vw;
  69. height: 42px;
  70. background: #FFE05C;
  71. border-radius: 27px;
  72. line-height: 42px;
  73. }
  74. .presentCount{
  75. font-size: 24rpx;
  76. color: #666666;
  77. }
  78. </style>