giveFamilyCard.vue 2.2 KB

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