couponDetail.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. <template>
  2. <view class="container">
  3. <view class="page-block">
  4. <view class="page-title-block">
  5. <view class="title">基本信息</view>
  6. </view>
  7. <view class="content">
  8. <view class="cell flex flex-y-center">
  9. <view class="title-block">
  10. <text>优惠券名称</text>
  11. </view>
  12. <view class="desc">
  13. <view class="input-box">{{info.name}}</view>
  14. </view>
  15. </view>
  16. <view class="cell flex flex-y-center">
  17. <view class="title-block">
  18. <text>发放对象</text>
  19. </view>
  20. <view class="desc">
  21. <view class="input-box">{{info.status == 1?'全平台':'新用户'}}</view>
  22. </view>
  23. </view>
  24. <view class="cell flex flex-y-center">
  25. <view class="title-block">
  26. <text>优惠券类别</text>
  27. </view>
  28. <view class="desc">
  29. <view class="input-box">{{info.type == 1?'满减券':'指定商品'}}</view>
  30. </view>
  31. </view>
  32. <view class="cell flex flex-y-center">
  33. <view class="title-block">
  34. <text>首页弹窗</text>
  35. </view>
  36. <view class="desc">
  37. <view class="input-box">{{info.is_index == 1?'是':'否'}}</view>
  38. </view>
  39. </view>
  40. <view class="cell flex flex-y-center">
  41. <view class="title-block">
  42. <text>优惠券数量</text>
  43. </view>
  44. <view class="desc">
  45. <view class="input-box">{{info.number}}</view>
  46. </view>
  47. </view>
  48. <view class="cell flex flex-y-center">
  49. <view class="title-block">
  50. <text>优惠券剩余数量</text>
  51. </view>
  52. <view class="desc">
  53. <view class="input-box">{{info.stock}}</view>
  54. </view>
  55. </view>
  56. </view>
  57. </view>
  58. <view class="page-block">
  59. <view class="page-title-block">
  60. <view class="title">优惠信息</view>
  61. </view>
  62. <view class="content">
  63. <view class="cell flex flex-y-center">
  64. <view class="title-block">
  65. <text>抵扣金额</text>
  66. </view>
  67. <view class="desc">
  68. <view class="input-box">{{info.reduce}}</view>
  69. </view>
  70. </view>
  71. <view class="cell flex flex-y-center">
  72. <view class="title-block">
  73. <text>满减金额</text>
  74. </view>
  75. <view class="desc">
  76. <view class="input-box">{{info.full}}</view>
  77. </view>
  78. </view>
  79. <view class="cell flex flex-y-center">
  80. <view class="title-block">
  81. <text>有效期</text>
  82. </view>
  83. <view class="desc">
  84. <view class="input-box">{{info.start_time}} - {{info.end_time}}</view>
  85. </view>
  86. </view>
  87. </view>
  88. </view>
  89. <view class="page-block" v-if="info.type == 2">
  90. <view class="page-title-block">
  91. <view class="title">指定商品</view>
  92. </view>
  93. <view class="content">
  94. <view class="cell flex flex-y-center goods-item">
  95. <image src="../static/images/avatar_def.png" mode="aspectFill" class="goods-img"></image>
  96. <view class="goods-info">
  97. <view class="name text-1">巨无霸汉堡</view>
  98. <view class="stock text-1">库存:100</view>
  99. <view class="price text-1">¥100.00</view>
  100. </view>
  101. </view>
  102. <view class="cell flex flex-y-center goods-item">
  103. <image src="../static/images/avatar_def.png" mode="aspectFill" class="goods-img"></image>
  104. <view class="goods-info">
  105. <view class="name text-1">巨无霸汉堡</view>
  106. <view class="stock text-1">库存:100</view>
  107. <view class="price text-1">¥100.00</view>
  108. </view>
  109. </view>
  110. </view>
  111. </view>
  112. <view style="height:30rpx;"></view>
  113. <view class="footer-bar" style="height: 100rpx;">
  114. <view class="content flex flex-center" style="height: 100rpx;">
  115. <view class="detail-btn flex flex-center" style="border-right: 2rpx solid #F4F5F7;" @click="onDel">
  116. <image src="../static/images/icon_16.png" mode="aspectFit" class="btn-icon"></image>
  117. <view style="color:#999999">删除优惠券</view>
  118. </view>
  119. <view class="detail-btn flex flex-center" @click="toEdit">
  120. <image src="../static/images/icon_17.png" mode="aspectFit" class="btn-icon"></image>
  121. <view style="color:#3387FF">重新编辑</view>
  122. </view>
  123. </view>
  124. </view>
  125. </view>
  126. </template>
  127. <script>
  128. export default {
  129. data() {
  130. return {
  131. id:"",
  132. info:{}
  133. }
  134. },
  135. onLoad(options) {
  136. this.id = options.id
  137. this.getData()
  138. },
  139. methods: {
  140. getData(){
  141. this.request({
  142. url:"Smdcshop/coupon_info",
  143. data:{
  144. id:this.id
  145. }
  146. }).then(res=>{
  147. if(res.code == 200){
  148. this.info = res.data
  149. }
  150. }).catch(err=>{
  151. console.log('err:',err)
  152. })
  153. },
  154. toEdit(){
  155. uni.redirectTo({
  156. url:`/saomaDiancan/editCoupon/editCoupon?id=${this.info.id}`
  157. })
  158. },
  159. onDel(){
  160. uni.showModal({
  161. content:"确定删除该优惠券",
  162. success: (r) => {
  163. if(r.confirm){
  164. this.request({
  165. url:"Smdcshop/coupon_delect",
  166. data:{
  167. id:this.info.id
  168. }
  169. }).then(res=>{
  170. if(res.code == 200){
  171. let pages = getCurrentPages();
  172. let prevPage = pages[pages.length - 2];
  173. //
  174. // #ifdef H5
  175. prevPage.getData(1)
  176. // #endif
  177. // #ifndef H5
  178. prevPage.$vm.getData(1)
  179. // #endif
  180. uni.navigateBack()
  181. }
  182. })
  183. }
  184. }
  185. })
  186. }
  187. }
  188. }
  189. </script>
  190. <style>
  191. @import url("../static/css/common.css");
  192. page {
  193. background: #F4F5F7;
  194. }
  195. .goods-item{
  196. padding:25rpx 0;
  197. }
  198. .goods-item .goods-img{
  199. display: block;
  200. width: 120rpx;
  201. height: 120rpx;
  202. border-radius: 8rpx;
  203. }
  204. .goods-item .goods-info{
  205. padding-left: 25rpx;
  206. }
  207. .goods-item .goods-info .name{
  208. font-size: 30rpx;
  209. font-weight: 600;
  210. color: #333;
  211. line-height: 1;
  212. }
  213. .goods-item .goods-info .stock{
  214. font-size: 24rpx;
  215. color: #999;
  216. margin-top: 16rpx;
  217. line-height: 1;
  218. }
  219. .goods-item .goods-info .price{
  220. font-size: 30rpx;
  221. color: #FD3939;
  222. margin-top: 20rpx;
  223. font-weight: 600;
  224. line-height: 1;
  225. }
  226. </style>