join_huodong.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. <template>
  2. <view class="padding">
  3. <view class="text-white padding bg radius">
  4. <u-form :model="shop" label-position="top">
  5. <!-- <u-form-item label="参与活动的商品:">
  6. <view class="list-box-c-r" @click="selectShang">
  7. 选择
  8. </view>
  9. </u-form-item> -->
  10. <u-form-item label="活动名称:">
  11. <text>{{info.title}}</text>
  12. </u-form-item>
  13. <u-form-item label="活动图片:">
  14. <view class="imgs" v-for="(item,index) in info.image.split(',')" :key="index">
  15. <img width="100%" class="images" height="100%" :src="item" alt="">
  16. </view>
  17. </u-form-item>
  18. <u-form-item label="活动详情:">
  19. <text v-html="info.content"></text>
  20. </u-form-item>
  21. <u-form-item label="参与活动的优惠:">
  22. <text v-if="info.type=='1'">普通活动</text>
  23. <text v-if="info.type=='2'">时段优惠</text>
  24. <text v-if="info.type=='3'">满额优惠</text>
  25. <text v-if="info.type=='4'">全场优惠</text>
  26. </u-form-item>
  27. <u-form-item label="适用情况:" v-if="info.type=='2' || info.type=='3' || info.type=='4'">
  28. <u-radio-group v-model="suitType">
  29. <u-radio name='1'>皆适用</u-radio>
  30. <u-radio name='2'>仅争对第一次下单</u-radio>
  31. </u-radio-group>
  32. </u-form-item>
  33. <u-form-item label="活动限制:" v-if="info.type=='2' || info.type=='3' || info.type=='4'">
  34. <u-radio-group v-model="limitType">
  35. <u-radio name='1'>无限制</u-radio>
  36. <u-radio name='2'>每天使用</u-radio>
  37. <input v-model="limitNum" style="background-color: rgba(128, 128, 128, 0.3);" type="number" />
  38. <text>次</text>
  39. </u-radio-group>
  40. </u-form-item>
  41. <u-form-item label="活动日期:">
  42. <text>{{info.startTime}}至{{info.endTime}}</text>
  43. </u-form-item>
  44. </u-form>
  45. </view>
  46. <u-button @click="submit" class="margin-top" :custom-style="customStyle" shape="square" :hair-line="false">确认
  47. </u-button>
  48. </view>
  49. </template>
  50. <script>
  51. export default {
  52. data() {
  53. return {
  54. customStyle: {
  55. backgroundColor: '#FFCC00',
  56. color: '#000000',
  57. border: 0
  58. },
  59. info: {},
  60. activityId:'',
  61. suitType:'1',//适用情况
  62. limitType:'1',//使用限制
  63. limitNum:'',
  64. actShopid:'',//选择商品的id
  65. shunxu:'',
  66. }
  67. },
  68. onLoad(option) {
  69. this.activityId = option.activityId
  70. this.shunxu=option.shunxu
  71. this.getInfo()
  72. },
  73. methods: {
  74. //活动详情
  75. getInfo() {
  76. var activityId=this.activityId
  77. this.$Request.get(`/admin/activity/${activityId}`).then(res => {
  78. if(res.msg=='success'){
  79. this.content = res.data.content.replace(new RegExp("img", "g"),
  80. 'img style="width:100%;height:auto;"')
  81. this.info = res.data
  82. this.imgs = res.data.image.split(',')
  83. }else{
  84. uni.showToast({
  85. title: res.msg,
  86. icon: 'none'
  87. })
  88. }
  89. });
  90. },
  91. //参与活动
  92. submit(){
  93. var shopid=[uni.getStorageSync('shopId')]
  94. if (this.limitType == '') {
  95. uni.showToast({
  96. title: '有限制时不能为空',
  97. icon: 'none'
  98. })
  99. return
  100. }
  101. let data = {
  102. "activityId": this.activityId,
  103. "limitType": this.limitType,
  104. "limitValue": this.limitNum,
  105. "shopIds": shopid,
  106. "suitType": this.suitType
  107. }
  108. this.$Request.postJson("/admin/activity-shop/join", data).then(res => {
  109. if(res.code==0){
  110. this.actShopid=res.data
  111. uni.showToast({
  112. title: '操作成功',
  113. icon: 'success'
  114. })
  115. uni.navigateBack({
  116. delta: 1
  117. })
  118. }else{
  119. uni.showModal({
  120. title: '提示',
  121. content: res.msg,
  122. success: function (res) {
  123. if (res.confirm) {
  124. } else if (res.cancel) {
  125. }
  126. }
  127. });
  128. }
  129. });
  130. },
  131. }
  132. }
  133. </script>
  134. <style>
  135. page {
  136. background-color: #F5F5F5;
  137. }
  138. .bg {
  139. background-color: #FFFFFF;
  140. }
  141. .tabBox {
  142. border: 1rpx solid #999999;
  143. padding: 15rpx 20rpx;
  144. border-radius: 15rpx;
  145. font-size: 28rpx;
  146. }
  147. .btnnum {
  148. color: #005DFF;
  149. border: 1rpx solid #005DFF;
  150. }
  151. .list-box-c-r {
  152. width: 120rpx;
  153. height: 62rpx;
  154. background: #FCD202;
  155. line-height: 62rpx;
  156. text-align: center;
  157. font-size: 26rpx;
  158. border-radius: 24rpx;
  159. }
  160. </style>