huodongCouponList.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  1. <template>
  2. <view class="content">
  3. <!-- <view class="page-top">
  4. <uni-search-bar :radius="100" placeholder="搜索" @confirm="search"></uni-search-bar>
  5. </view> -->
  6. <no-none v-if='list.length<=0'></no-none>
  7. <block v-else>
  8. <view @click="bindDetail(item.id)" style="margin-top: 30rpx;" class="item" v-for="(item,index) of list"
  9. :key='index'>
  10. <view class="border-b item-title flex-y-center">
  11. <view class="item-type flex-center"
  12. :class="item.status==3?'item-type-two':item.status==4?'item-type-one':'item-type-three'">
  13. {{item.status==3?'已生效':item.status==4?'已停止':'待激活'}}
  14. </view>
  15. <!-- 3:已生效,4:已停止,其他:待激活 -->
  16. <text>{{item.activity_name}}</text>
  17. <view class="del-btn" @click.stop="del(item.id,index)" v-if="item.status != 4">删除</view>
  18. </view>
  19. <view class="item-bottom flex-y-center">
  20. <view class="flex-grow-1">
  21. <view class="box-pack-between item-bottom-right">
  22. <text><text class="item-bottom-number">活动ID</text>:{{item.activity_id}}</text>
  23. </view>
  24. <view class="box-pack-between item-bottom-right flex-y-center">
  25. <text><text class="item-bottom-number">卡券面额</text>:{{item.amount}} </text>
  26. <text class="iconfont icongengduo"></text>
  27. </view>
  28. </view>
  29. </view>
  30. </view>
  31. </block>
  32. <view style="height: 90px;"></view>
  33. <navigator style="margin-bottom:0" url='./addHuodongCoupon' class="bottom-bar flex-center">
  34. <button formType="submit" class="flex-center ft28">+新增优惠劵</button>
  35. </navigator>
  36. </view>
  37. </template>
  38. <script>
  39. export default {
  40. data() {
  41. return {
  42. defaultIndex: 0,
  43. list: [],
  44. page: 1,
  45. $test: this.$test.$test,
  46. URL: getApp().globalData.URL,
  47. is_load: false
  48. }
  49. },
  50. onLoad() {
  51. uni.setNavigationBarTitle({
  52. title: "商家活动券"
  53. })
  54. },
  55. onShow() {
  56. this.page = 1;
  57. this.list = [];
  58. this.http();
  59. },
  60. onReachBottom(e) {
  61. if (!this.is_load) {
  62. this.page = this.page + 1;
  63. this.http();
  64. }
  65. },
  66. methods: {
  67. enit(id) {
  68. uni.navigateTo({
  69. url: "./add?id=" + id
  70. })
  71. },
  72. previewImg(logourl) {
  73. let URL = this.URL + logourl;
  74. uni.previewImage({
  75. urls: [URL]
  76. });
  77. },
  78. bindDetail(id) {
  79. console.log(id)
  80. uni.navigateTo({
  81. url: `./huodongCouponDetail?id=${id}`
  82. })
  83. },
  84. http() {
  85. let url = "alipaycoupon/merchant_coupon_data";
  86. this.request({
  87. url,
  88. data: {
  89. admin_id: uni.getStorageSync("admin_id"),
  90. page: this.page,
  91. limit: 10,
  92. },
  93. }).then(res => {
  94. console.log(res, "res")
  95. if (res.code === "200") {
  96. this.list = this.list.concat(res.data);
  97. if (res.data.length == 0) {
  98. this.is_load = true
  99. } else {
  100. this.is_load = false
  101. }
  102. }
  103. });
  104. },
  105. del(id, index) {
  106. uni.showModal({
  107. title: '提示',
  108. content: '是否要删除?',
  109. showCancel: true,
  110. cancelText: '取消',
  111. confirmText: '确定',
  112. success: res => {
  113. if (res.confirm) {
  114. this.request({
  115. url: "alipaycoupon/merchant_coupon_stop",
  116. data: {
  117. admin_id: uni.getStorageSync('admin_id'),
  118. id: id,
  119. },
  120. }).then(res => {
  121. console.log(res, "res")
  122. if (res.code === 200 || res.code === "200") {
  123. this.list.splice(index, 1);
  124. uni.showModal({
  125. content: "删除成功",
  126. showCancel: false
  127. })
  128. }
  129. }).catch(() => {
  130. uni.showToast({
  131. title: res.message,
  132. icon: "none",
  133. })
  134. });
  135. }
  136. },
  137. fail: () => {},
  138. complete: () => {}
  139. });
  140. },
  141. },
  142. }
  143. </script>
  144. <style lang="scss">
  145. page {
  146. background: #F5F7FA;
  147. }
  148. .page-top {
  149. background: #fff;
  150. position: sticky;
  151. top: 0;
  152. z-index: 99;
  153. padding: 10rpx 0;
  154. box-shadow: 0 5rpx 10rpx #f0f0f0;
  155. }
  156. .item {
  157. width: 690rpx;
  158. background: #ffffff;
  159. margin: 0 auto;
  160. padding: 0rpx 24rpx;
  161. opacity: 1;
  162. border-radius: 8rpx;
  163. box-shadow: 0rpx 6rpx 10rpx 0rpx rgba(213, 213, 213, 0.04);
  164. .item-title {
  165. opacity: 1;
  166. font-size: 28rpx;
  167. font-family: PingFang SC, PingFang SC-Medium;
  168. font-weight: 500;
  169. color: #333333;
  170. padding: 24rpx 0;
  171. .item-type {
  172. margin-right: 16rpx;
  173. // width: 78rpx;
  174. height: 36rpx;
  175. font-size: 21rpx;
  176. opacity: 1;
  177. border-radius: 4rpx;
  178. color: #FFFFFF;
  179. border-bottom: 1rpx solid #F1F1F1;
  180. padding: 0 13rpx;
  181. }
  182. .item-type-one {
  183. background: linear-gradient(134deg, #FF8C1A 2%, #FF8C1A 98%);
  184. }
  185. .item-type-two {
  186. background: linear-gradient(135deg, #4992ff 2%, #61a8fc 97%);
  187. }
  188. .item-type-three {
  189. background: linear-gradient(134deg, #febe07 2%, #ffcc3e 98%);
  190. }
  191. .del-btn {
  192. height: 50rpx;
  193. border-radius: 12rpx;
  194. padding: 0 24rpx;
  195. background: #ff3535;
  196. color: #fff;
  197. font-size: 24rpx;
  198. font-weight: 500;
  199. line-height: 50rpx;
  200. margin-left: auto;
  201. }
  202. }
  203. .item-bottom {
  204. font-size: 26rpx;
  205. padding: 20rpx 0 24rpx 0;
  206. color: #666666;
  207. .item-bottom-left {
  208. width: 90rpx;
  209. height: 90rpx;
  210. margin-right: 24rpx;
  211. min-width: 90rpx;
  212. margin-bottom: 16rpx;
  213. }
  214. .item-bottom-right {
  215. margin-bottom: 16rpx;
  216. .item-bottom-number {
  217. color: #99A0AD;
  218. }
  219. }
  220. }
  221. }
  222. .color-ffa {
  223. color: #3387FF;
  224. }
  225. .icongengduo {
  226. color: #999;
  227. font-size: 24rpx;
  228. }
  229. .bottom-bar {
  230. position: fixed;
  231. bottom: 0px;
  232. width: 100%;
  233. z-index: 1000;
  234. background: #FFFFFF;
  235. padding: 30rpx 0;
  236. }
  237. .bottom-bar button {
  238. width: 690rpx;
  239. height: 98rpx;
  240. opacity: 1;
  241. background: linear-gradient(315deg, #3387ff 2%, #569bff 99%);
  242. border-radius: 8rpx;
  243. box-shadow: 0rpx 0rpx 8rpx 0rpx rgba(51, 135, 255, 0.20);
  244. margin: 0 auto;
  245. opacity: 1;
  246. font-size: 36rpx;
  247. font-family: PingFang SC, PingFang SC-Medium;
  248. font-weight: 500;
  249. color: #ffffff;
  250. }
  251. .label {
  252. min-width: 70rpx;
  253. height: 44rpx;
  254. /* line-height: 44rpx; */
  255. padding: 0 10rpx;
  256. color: #FFFFFF;
  257. font-size: 24rpx;
  258. background-color: #1E9FFF;
  259. margin-left: 20rpx;
  260. border-radius: 5rpx;
  261. }
  262. </style>