vipcm.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. <template>
  2. <view class="pd16_15">
  3. <radio-group>
  4. <view class="flex wrap space mt16">
  5. <view v-for="(item,index) in moneyList" :key="index" :class="index > 1 ? 'mt16' : ''" @click="clickNum(item.num,index)" class="box pd20_15 flex alcenter space" style="width: 330rpx;">
  6. <text class="ft14 cl-main ftw600">{{item.num}}</text>
  7. <radio :value="item.coupon+''" :checked="num == item.num" :color="tempColor" />
  8. </view>
  9. </view>
  10. </radio-group>
  11. <view class="form-footer-h">
  12. <view class="form-footer form-footer-h">
  13. <view class="form-footer-main pd10_15">
  14. <button @click="paySuccess" class="btn-big" :style="getBtnStyle">确定</button>
  15. </view>
  16. </view>
  17. </view>
  18. <hFormAlert v-if="cancelShow" title="" name="cancel_desc" placeholder="请输入卡密卡号" @confirm="confirm" @cancel="cancel"></hFormAlert>
  19. <dialog-couponshare v-if="showCouponInvite" @closed="closedInvite"></dialog-couponshare>
  20. </view>
  21. </template>
  22. <script>
  23. import hFormAlert from '@/components/h-form-alert/h-form-alert.vue';
  24. export default{
  25. components: {hFormAlert},
  26. data(){
  27. return {
  28. num:'',
  29. moneyList:[],
  30. numa:'',
  31. userinfo:'',
  32. paysj:'',
  33. showCouponInvite:false,
  34. cancelShow:false,
  35. vid:0,
  36. mid:0,
  37. hbmc:''
  38. }
  39. },
  40. computed:{
  41. getCoupon(){
  42. for(var a in this.moneyList){
  43. if(this.moneyList[a].num == this.num){
  44. return this.moneyList[a].coupon;
  45. }
  46. }
  47. return 0;
  48. }
  49. },
  50. onLoad(e){
  51. this.hbmc=uni.getStorageSync("config").site.hbmc
  52. if(e.vid){
  53. this.vid=e.vid
  54. }
  55. if(e.mid){
  56. this.mid=e.mid
  57. }
  58. this.paysja()
  59. },
  60. onShareAppMessage(e){
  61. },
  62. onShareTimeline(e){
  63. },
  64. methods:{
  65. changeNum(e){
  66. console.log(e);
  67. this.num = e.detail.value;
  68. },
  69. clickNum(value,index){
  70. this.num = value;
  71. this.numa=this.moneyList[index].coupon
  72. },
  73. async paysja(){
  74. //this.showCouponInvite = true;
  75. let data = {};
  76. data.token = uni.getStorageSync("userinfo").token;
  77. data.uid = uni.getStorageSync("userinfo").id;
  78. uni.request({
  79. url: this.configs.webUrl+'/api/user/paysj',
  80. data: data,
  81. success: res =>{
  82. if(res.data.code==1){
  83. this.moneyList =res.data.data
  84. }else{
  85. }
  86. },
  87. fail: (data, code) => {
  88. //console.log('fail' + JSON.stringify(data));
  89. }
  90. });
  91. },
  92. paySuccess(){
  93. var _this=this
  94. uni.showModal({
  95. title: '温馨提示',
  96. content: '是否确定支付升级',
  97. showCancel: true,
  98. confirmText: "确定",
  99. success: function (res) {
  100. if (res.confirm) {
  101. _this.paySuccesspost()
  102. } else if (res.cancel) {
  103. }
  104. }
  105. });
  106. },
  107. paySuccesspost(){
  108. //this.showCouponInvite = true;
  109. let data = {};
  110. data.token = uni.getStorageSync("userinfo").token;
  111. data.uid = uni.getStorageSync("userinfo").id;
  112. data.num = this.numa;
  113. if(this.vid>0){
  114. data.vid = this.vid;
  115. }
  116. if(this.mid>0){
  117. data.mid = this.mid;
  118. }
  119. uni.request({
  120. url: this.configs.webUrl+'/api/user/vipsj',
  121. data: data,
  122. success: res =>{
  123. if(res.data.code==1){
  124. uni.showModal({
  125. title: '温馨提示',
  126. content: res.data.msg,
  127. showCancel: false,
  128. confirmText: "确定",
  129. success: function (res) {
  130. if (res.confirm) {
  131. uni.navigateBack();
  132. } else if (res.cancel) {
  133. }
  134. }
  135. });
  136. }else{
  137. if(res.data.msg=='余额不足'){
  138. uni.showModal({
  139. title: '提示',
  140. content: this.hbmc+'不足',
  141. showCancel: true,
  142. confirmText: "充值",
  143. success: function (res) {
  144. if (res.confirm) {
  145. uni.navigateTo({
  146. url:"/pages/client/vipcard/recharge"
  147. })
  148. } else if (res.cancel) {
  149. //uni.navigateBack();
  150. }
  151. }
  152. });
  153. }else{
  154. uni.showToast({ title: res.data.msg,icon:"none" });
  155. }
  156. }
  157. },
  158. fail: (data, code) => {
  159. //console.log('fail' + JSON.stringify(data));
  160. }
  161. });
  162. },
  163. closedInvite(){
  164. this.showCouponInvite = false;
  165. let pages = getCurrentPages();
  166. uni.navigateBack({
  167. delta:pages.length
  168. });
  169. }
  170. }
  171. }
  172. </script>
  173. <style>
  174. .tag-coupon{
  175. width: 100%;
  176. height: 80rpx;
  177. border-radius: 16rpx;
  178. text-align: center;
  179. line-height: 80rpx;
  180. font-size: 28rpx;
  181. }
  182. .recharge-header{
  183. height: 240rpx;
  184. width: 100%;
  185. position: relative;
  186. }
  187. .recharge-header image{
  188. width: 100%;
  189. height: 240rpx;
  190. }
  191. .recharge-header .main{
  192. position: absolute;
  193. width: 100%;
  194. height: 240rpx;
  195. left: 0;
  196. top: 0;
  197. }
  198. .tdadf{
  199. border: 1px solid #f8f8f8; padding: 10px 5px; background: #ffffff; border-radius: 8px; box-shadow: 0px 4px 20px 0px rgba(0,0,0,0.04);
  200. }
  201. </style>