use-coupon-list.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411
  1. <template>
  2. <view class="tab-b">
  3. <view class="tab-b-c list-item" >
  4. <block v-for="(item,index) in list" :key="index" >
  5. <view class="item" @click="bindChecked(index,item.checked)">
  6. <view class="ticket-content" >
  7. <view class="content">
  8. <view class="ticket-img">
  9. <!-- 商品券 -->
  10. <image src="/static/images/cof_ico.png" v-if="item.ticket.type==1" class="img" mode="aspectFill"></image>
  11. <!-- 课程券 -->
  12. <image src="/static/images/fit_ico.png" v-if="item.ticket.type==2" class="img" mode="aspectFill"></image>
  13. <!-- 剧场活动,早鸟会员 -->
  14. <image src="/static/images/soci_ico.png" v-if="item.ticket.type==3||item.ticket.type==4" class="img" mode="aspectFill"></image>
  15. </view>
  16. <view class="ticket-info" >
  17. <view class="ticket-name">
  18. <block v-if="item.ticket.type==1 && item.ticket.limitGoodsId>0">{{item.ticket.limitGoodsId}}</block>
  19. <block v-else>{{item.ticket.name}}</block>
  20. </view>
  21. <view class="ticket-expire" v-if="item.ticket.goodsList.length>0">可兑换商品:
  22. <block v-for="(goods,goodsIndex) in item.ticket.goodsList">
  23. <block v-if="goodsIndex>0">
  24. ,{{goods.name}}
  25. </block>
  26. <block v-else>{{goods.name}}</block>
  27. </block></view>
  28. <view class="ticket-expire" v-else>不限商品</view>
  29. <view class="ticket-expire" >有效期:{{item.startTime}} 至 {{item.endTime}}</view>
  30. <view class="ticket-expire">
  31. {{item.ticket.intro}}
  32. </view>
  33. </view>
  34. <view class="ticket-status-st used" >
  35. <view class="ticket-st" >
  36. {{item.status==5?"待使用":""}}
  37. {{item.status==6?"待核销":""}}
  38. {{item.status==7?"已核销":""}}
  39. {{item.status==8?"已取消":""}}
  40. </view>
  41. </view>
  42. </view>
  43. </view>
  44. <view class="ticket-splite">
  45. <view class="left"></view>
  46. <view class="mid"></view>
  47. <view class="right"></view>
  48. </view>
  49. <view class="ticket-other">
  50. <!-- <view class="btn">
  51. <button @click="onViewTicket(it.list[0].hxCode)" class="btn-user" v-if="it.qty==1 && it.list[0].status==6">使用</button>
  52. <button @click="onViewTicketMore(it)" class="btn-user" v-if="it.qty>1">点击展开</button>
  53. </view> -->
  54. </view>
  55. </view>
  56. </block>
  57. <!-- <view class="coupon-foot flex-grow-1" v-if="item.checked">
  58. <view class="box-pack-between">
  59. <view class="mrt16 flex flex-grow-1">
  60. <text style="min-width: 190rpx;">指定商品:</text>
  61. <view class="flex-grow-1">
  62. <view class="box-pack-between" v-for="(items,index) of item.goods"> {{items.name}}
  63. <text style="color: red;">¥{{items.price}}</text>
  64. </view>
  65. </view>
  66. </view>
  67. </view>
  68. </view> -->
  69. </view>
  70. <!-- #ifdef MP-ALIPAY -->
  71. <view class="ft22" style="margin: 20rpx; color: red;">
  72. <text>*提示:商家劵无法使用余额支付,请选择支付宝支付</text>
  73. </view>
  74. <!-- #endif -->
  75. <view class="btn flex-center" @click="back">
  76. 不使用优惠劵
  77. </view>
  78. </view>
  79. </template>
  80. <script>
  81. export default {
  82. data() {
  83. return {
  84. active: 1,
  85. userInfo: {},
  86. list: [],
  87. checked: -1,
  88. check_index:1,
  89. state:''
  90. }
  91. },
  92. onLoad(e) {
  93. this.userInfo = uni.getStorageSync('userInfo')
  94. this.total_price = Number(e.total_price);
  95. this.state = e.state||'';
  96. let check_index = 1;
  97. if(e.pay_index==0){
  98. // #ifdef MP-ALIPAY
  99. check_index = 2;
  100. // #endif
  101. }else{
  102. check_index = e.check_index
  103. }
  104. this.check_index = check_index;
  105. this.getData();
  106. },
  107. methods: {
  108. back(e) {
  109. let pages = getCurrentPages(); //获取所有页面栈实例列表
  110. let nowPage = pages[pages.length - 1]; //当前页页面实例
  111. let prevPage = pages[pages.length - 2]; //上一页页面实例
  112. prevPage.$vm.coupon_id = ""; //修改上一页data里面的sh参数值为100
  113. prevPage.$vm.coupon_price = 0;
  114. prevPage.$vm.activity = '';
  115. prevPage.$vm.voucherCode = '';
  116. prevPage.$vm.coupon_full =''
  117. uni.navigateBack({
  118. delta: 1
  119. })
  120. },
  121. bindChecked(index, checked) {
  122. if (checked) {
  123. this.checked = index;
  124. let pages = getCurrentPages(); //获取所有页面栈实例列表
  125. let nowPage = pages[pages.length - 1]; //当前页页面实例
  126. let prevPage = pages[pages.length - 2]; //上一页页面实例
  127. prevPage.$vm.coupon_id = this.list[index].id; //修改上一页data里面的sh参数值为100
  128. let cartList=prevPage.$vm.carInfo.list;
  129. let price=0;
  130. for(var i=0;i<cartList.length;i++){
  131. if(this.list[index].ticket.limitGoodsId==''){
  132. price=cartList[i].price;
  133. break;
  134. }else if(this.list[index].ticket.limitGoodsId.indexOf(cartList[i].goods_id)>=0){
  135. price=cartList[i].price;
  136. break;
  137. }
  138. }
  139. prevPage.$vm.coupon_price = Number(price);
  140. console.log('carInfo',prevPage.$vm.carInfo);
  141. prevPage.$vm.activity = this.list[index].activity||'';
  142. prevPage.$vm.voucherCode = this.list[index].voucherCode||'';
  143. prevPage.$vm.coupon_full = this.list[index].full||'';
  144. uni.navigateBack({
  145. delta: 1
  146. })
  147. } else {
  148. uni.showToast({
  149. title: "不符合使用要求",
  150. icon: "none"
  151. })
  152. }
  153. },
  154. onChangeTab(index) {
  155. if (index != this.active) {
  156. this.active = index
  157. }
  158. },
  159. getData() {
  160. this.$http.request('xcx/payTicket', {
  161. user_id: uni.getStorageSync('user_id'),
  162. // store_id: uni.getStorageSync('store_id'),
  163. // is_use: this.state, //1堂食 2外卖 3自提
  164. }).then(res => {
  165. for (let s of res.data) {
  166. s.checked = true;
  167. };
  168. this.list = res.data
  169. console.log(this.list);
  170. })
  171. }
  172. }
  173. }
  174. </script>
  175. <style lang="scss">
  176. @import "./use-coupon-list.scss";
  177. page {
  178. background-color: #F4F5F7;
  179. }
  180. .btn {
  181. display: block;
  182. border: 1rpx solid #ddd;
  183. color: #555;
  184. padding: 16rpx;
  185. background: #fff;
  186. border-radius: 10rpx;
  187. text-align: center;
  188. width: 680rpx;
  189. margin: 0 auto;
  190. height: 80rpx;
  191. }
  192. .content {
  193. position: relative;
  194. }
  195. .iconfont-rund {
  196. width: 32rpx;
  197. height: 32rpx;
  198. border: 1rpx solid #999;
  199. border-radius: 50%;
  200. }
  201. .check-box {
  202. color: #007AFF;
  203. }
  204. .tab-h {
  205. background-color: #fff;
  206. position: sticky;
  207. top: 0;
  208. z-index: 100
  209. }
  210. .tab-b-c {
  211. margin-bottom: 30rpx;
  212. }
  213. .tab-h .item {
  214. height: 100px;
  215. position: relative;
  216. flex: 1;
  217. text-align: center;
  218. }
  219. .tab-h .item .title {
  220. font-size: 28rpx;
  221. line-height: 88rpx;
  222. font-weight: 500;
  223. }
  224. .tab-h .item.active::after {
  225. content: "";
  226. display: block;
  227. height: 4rpx;
  228. width: 40rpx;
  229. border-radius: 2rpx;
  230. background-color: #247EFF;
  231. position: absolute;
  232. bottom: 5rpx;
  233. left: 50%;
  234. transform: translateX(-50%)
  235. }
  236. .tab-h .item.active .title {
  237. font-size: 32rpx;
  238. font-weight: 600;
  239. color: #247EFF;
  240. }
  241. .tab-b {
  242. padding: 30rpx 25rpx 0;
  243. }
  244. .tab-b .item {
  245. width: 100%;
  246. height: 160px;
  247. position: relative;
  248. // margin-left: 10px;
  249. }
  250. .tab-b .item .coupon-bg {
  251. display: block;
  252. width: 100%;
  253. height: 100%;
  254. position: absolute;
  255. left: 0;
  256. top: 0;
  257. z-index: 0;
  258. }
  259. .tab-b .item .content {
  260. position: relative;
  261. z-index: 10;
  262. }
  263. .tab-b .item .content .left-bar {
  264. flex: none;
  265. width: 200rpx;
  266. height: 180rpx;
  267. text-align: center;
  268. }
  269. .tab-b .item .content .left-bar .money {
  270. font-size: 58rpx;
  271. line-height: 70rpx;
  272. color: #fff;
  273. font-weight: bold;
  274. }
  275. .tab-b .item .content .left-bar .unit {
  276. font-size: 24rpx;
  277. color: #fff;
  278. font-weight: 500;
  279. margin-left: 6rpx;
  280. }
  281. .tab-b .item .content .left-bar .desc {
  282. font-size: 24rpx;
  283. line-height: 33rpx;
  284. margin-top: 16rpx;
  285. color: #fff;
  286. }
  287. .tab-b .item .content .right-bar {
  288. /* width: 500rpx; */
  289. box-sizing: border-box;
  290. height: 180rpx;
  291. padding: 0 25rpx;
  292. }
  293. .tab-b .item .content .right-bar .title-block {
  294. height: 106rpx;
  295. border-bottom: 1rpx dashed #E5E5E5;
  296. }
  297. .tab-b .item .content .right-bar .title-block .tips {
  298. flex: none;
  299. height: 40rpx;
  300. background: #247EFF;
  301. border-radius: 4rpx;
  302. font-size: 20rpx;
  303. color: #fff;
  304. padding: 0 10rpx;
  305. line-height: 40rpx;
  306. margin-right: 16rpx;
  307. }
  308. .tab-b .item .content .right-bar .title-block .title {
  309. font-size: 28rpx;
  310. color: #333;
  311. font-weight: bold;
  312. }
  313. .tab-b .item .content .right-bar .time {
  314. font-size: 20rpx;
  315. color: #999;
  316. height: 73rpx;
  317. line-height: 73rpx;
  318. }
  319. .more-down {
  320. width: 33rpx;
  321. height: 33rpx;
  322. }
  323. .more-down-deg {
  324. transform: rotate(180deg);
  325. animation: showPopUp 0.2s;
  326. animation-fill-mode: forwards;
  327. }
  328. @keyframes showPopUp {
  329. 0% {
  330. transform: rotate(0deg);
  331. }
  332. 100% {
  333. transform: rotate(180deg);
  334. }
  335. }
  336. .CouponContentC {
  337. color: #999999;
  338. }
  339. .coupon-foot {
  340. background: #FFFFFF;
  341. padding: 20rpx;
  342. font-size: 28rpx;
  343. border-bottom: 1rpx solid #F1F1F1;
  344. }
  345. </style>