index.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. <template>
  2. <view class="order-content-wrap">
  3. <view class="custom-line"></view>
  4. <!-- 当前订单-->
  5. <view class="service-order">
  6. <!-- 门店列表 -->
  7. <view v-for="(item,index) in countsList" :class="computedStyle(item)" class="store-wrap bg-img">
  8. <view class="row-list" >
  9. <view class="store-content">
  10. <view class="h-left-content">
  11. <view class="h-text">
  12. <view class="money">¥{{item.discountsPrice}}</view>
  13. <view class="desc">{{item.name}}</view>
  14. </view>
  15. </view>
  16. <view class="h-center-content">
  17. <view class="title">
  18. <text class="h-value">门店通用</text>
  19. </view>
  20. <view class="title">
  21. 使用平台:<text v-if="item.strategyType == '0'">全平台</text>
  22. <text v-else-if="item.strategyType == '1'">个人优惠卷</text>
  23. </view>
  24. <view class="title">
  25. 有效时间:{{this.dateFormat(item.startTime)}}~{{this.dateFormat(item.endTime)}}
  26. </view>
  27. </view>
  28. <view class="h-right-content">
  29. <view class="h-btn">
  30. <view @click="gotoReceiveCoupon(item)" class="h-btn-value-receive">立即领取</view>
  31. </view>
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. <view v-if="countsList.length == 0" class="footer">
  37. <view class="">---暂无数据---</view>
  38. </view>
  39. <view v-if="countsList.length > 0" class="footer">
  40. <view class="">---到底了---</view>
  41. </view>
  42. </view>
  43. </view>
  44. </template>
  45. <script>
  46. export default {
  47. data() {
  48. return {
  49. currentServiceTab: 'orderTab1', // 当前选中的 Tab
  50. list: [1, 2, 3, 4],
  51. reqParm: {
  52. auth: true,
  53. id: null
  54. },
  55. countsList: []
  56. };
  57. },
  58. onLoad() {
  59. // 查询可领取的优惠劵
  60. this.getUserDiscountsList();
  61. },
  62. computed: {
  63. },
  64. methods: {
  65. // 日期格式化
  66. dateFormat(date){
  67. let time = Date.parse(date);
  68. return uni.$u.date(time, 'yyyy-mm-dd');
  69. },
  70. // 查询可领取的优惠劵
  71. getUserDiscountsList(){
  72. let that = this;
  73. // 用户绑定门店
  74. this.$api.getUserDiscountsList(this.reqParm).then((res)=>{
  75. console.log(res.data.data)
  76. this.countsList = res.data.data;
  77. }).catch(() =>{
  78. uni.showToast({
  79. title: "操作失败"
  80. })
  81. })
  82. },
  83. computedStyle(item) {
  84. return 'bg-img';
  85. },
  86. // 切换菜单
  87. changeServiceTab(tab){
  88. this.currentServiceTab = tab;
  89. },
  90. // 领取优惠劵
  91. gotoReceiveCoupon(item){
  92. let that = this;
  93. that.reqParm.id = item.id;
  94. // 用户绑定门店
  95. this.$api.claimCoupon(this.reqParm).then((res)=>{
  96. uni.showToast({
  97. title: "领取成功"
  98. })
  99. // 查询可领取的优惠劵
  100. that.getUserDiscountsList();
  101. // uni.$u.route({
  102. // url: '/pages/coupon/coupon',
  103. // params: {}
  104. // })
  105. }).catch(() =>{
  106. uni.showToast({
  107. title: "操作失败"
  108. })
  109. })
  110. },
  111. // 去使用优惠劵
  112. gotoUseCoupon(){
  113. uni.$u.route({
  114. url: '/pages/index/tabbar',
  115. params: {
  116. PageCur: 'goods'
  117. }
  118. })
  119. },
  120. },
  121. };
  122. </script>
  123. <style lang="scss" scoped>
  124. /* 服务订单内容*/
  125. .service-order-tab-bar{
  126. background: #fff;
  127. display: flex;
  128. justify-content: space-around;
  129. height: 50px;
  130. background-color: #f5f5f5;
  131. .service-order-tab-item{
  132. flex: 1;
  133. display: flex;
  134. align-items: center;
  135. justify-content: center;
  136. font-size: 16px;
  137. color: #333;
  138. line-height: 26px;
  139. }
  140. .service-order-tab-item.active {
  141. // color: #ff0000;
  142. }
  143. .underline {
  144. border-bottom: 2px solid #FFE05C ;
  145. }
  146. }
  147. .bg-img{
  148. background-image: url('/static/coupon/u210.png');
  149. background-repeat: repeat;
  150. height: 94px;
  151. margin: 12px;
  152. }
  153. .bg-img1{
  154. background-image: url('/static/coupon/u211.png');
  155. background-repeat: repeat;
  156. height: 94px;
  157. margin: 12px;
  158. }
  159. .service-order{
  160. // background: #fff;
  161. }
  162. /* 门店列表 */
  163. .store-wrap{
  164. border-radius: 2px;
  165. padding-bottom: 12px;
  166. padding-left: 12px;
  167. padding-right: 12px;
  168. .row-list{
  169. .store-content{
  170. display: flex;
  171. align-items: center;
  172. height: 94px;
  173. color: #333333;
  174. .h-left-content{
  175. width: 26%;
  176. text-align: center;
  177. .h-text{
  178. width: 100%;
  179. font-weight: 400;
  180. line-height: 18px;
  181. font-size: 12px;
  182. .money{
  183. font-size: 18px;
  184. font-weight: bold;
  185. line-height: 26px;
  186. }
  187. }
  188. }
  189. .h-center-content{
  190. width: 50%;
  191. padding-left: 12px;
  192. .title{
  193. width: 100%;
  194. color: #999999;
  195. font-size: 12px;
  196. .h-value{
  197. font-size: 14px;
  198. line-height: 42px;
  199. color: #333333;
  200. }
  201. }
  202. }
  203. .h-right-content{
  204. width: 24%;
  205. display: flex;
  206. justify-content: center;
  207. align-items: center;
  208. background-image: url('/static/coupon/u2102.png');
  209. height: 94px;
  210. font-size: 12px;
  211. .h-btn-value-use{
  212. background: #FFE05C;
  213. color: #333333;
  214. height: 30px;
  215. width: 80px;
  216. text-align: center;
  217. line-height: 30px;
  218. border-radius: 15px;
  219. }
  220. .h-btn-value-receive{
  221. background: #93D21A;
  222. color: #fff;
  223. height: 30px;
  224. width: 80px;
  225. text-align: center;
  226. line-height: 30px;
  227. border-radius: 15px;
  228. }
  229. .h-btn-img{
  230. display: flex;
  231. align-items: center;
  232. image{
  233. height: 68px;
  234. width: 68px;
  235. }
  236. }
  237. }
  238. }
  239. }
  240. }
  241. /* 产品订单 */
  242. .product-order{
  243. margin-top: 12px;
  244. }
  245. /* 底部 */
  246. .footer{
  247. margin-top: 30px;
  248. height: 120px;
  249. font-size: 12px;
  250. text-align: center;
  251. color: #666;
  252. }
  253. </style>