index.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326
  1. <template>
  2. <view class="container">
  3. <view class="process">
  4. <icon class="tt-icon" size="20" type="info" color="#FF9F18"></icon>
  5. <text>点击去预约,预约成功后等待上门服务!</text>
  6. </view>
  7. <view class="top-title">抖音团购在线预约</view>
  8. <view class="sub-title">我的待使用团购券 ({{orders.length}})</view>
  9. <view v-if="orders.length > 0" class="items">
  10. <view v-for="(item, index) in orders" :key="index">
  11. <view class="item" v-for="(item1, index1) in item.certificates" :key="index1">
  12. <view class="item-main">
  13. <view class="item-left">
  14. <image :src="item1.sku_info.goodsUrl + '?w=200'" mode="aspectFill"></image>
  15. </view>
  16. <view class="item-center">
  17. <view class="goods-name">{{ item1.sku_info.title }}</view>
  18. <view class="goods-time">{{ item1.validStr }}</view>
  19. <view class="service-times">剩余可约:{{ item1.sku_info.goodServiceCount }} 次</view>
  20. </view>
  21. <view class="status-btn">待使用</view>
  22. </view>
  23. <!-- v-if="item.can_use" -->
  24. <view
  25. class="item-bottom"
  26. :data-issave="item1.isSave"
  27. :data-amount="item1.amount.pay_amount"
  28. :data-sku="item1.sku_info.third_sku_id"
  29. :data-orderid="item.order_id"
  30. :data-jzorderid="item1.jzOrderId"
  31. :data-dySku="item1.sku_info.sku_id"
  32. :data-coupon="item1.certificate_id"
  33. @tap="goAppoint"
  34. >
  35. {{ item1.isSave?'预约详情':'去预约'}}
  36. </view>
  37. <!-- <view class="item" wx:for="{{orders}}" wx:key="index">
  38. <view class="left">
  39. <view class="title">{{item.certificates[0].sku_info.title}}
  40. ¥{{item.certificates[0].amount.pay_amount/100}}</view>
  41. <view class="desc">有效时间:{{item.certificates[0].validStr}}</view>
  42. </view>
  43. <view class="right">
  44. <view class="btn" wx:if="{{item.can_use}}" data-amount="{{item.certificates[0].amount.pay_amount}}"
  45. data-sku="{{item.certificates[0].sku_info.third_sku_id}}" data-orderid="{{item.order_id}}"
  46. data-dySku="{{item.certificates[0].sku_info.sku_id}}"
  47. data-coupon="{{item.certificates[0].certificate_id}}" bindtap="goAppoint">去预约</view>
  48. </view>
  49. </view> -->
  50. </view>
  51. </view>
  52. </view>
  53. <!-- <view v-else> -->
  54. <!-- <view class="noHave">没有更多了</view> -->
  55. <!-- <view class="noHave">没有更多可用券 建议授权后查询</view> -->
  56. <!-- <view style="text-align: center;color: #09afff;" bindtap="goLogin">去授权</view> -->
  57. <!-- </view> -->
  58. <view class="fresh-block">
  59. <text>找不到订单 </text>
  60. <text class="fresh-text" @tap="getList">点击刷新</text>
  61. </view>
  62. </view>
  63. </template>
  64. <script>
  65. var util = require('../../utils/util.js');
  66. var api = require('../../config/api.js');
  67. var user = require('../../utils/user.js');
  68. var app = getApp();
  69. export default {
  70. data() {
  71. return {
  72. orders: [],
  73. code: '' //抖音登录code
  74. };
  75. },
  76. onShow: function () {
  77. this.getList();
  78. },
  79. onLoad: function (options) {},
  80. methods: {
  81. getList(){
  82. uni.showLoading({
  83. title: '加载中'
  84. });
  85. user.login().then((ress) => {
  86. util.request(api.DouyinCouponList, {
  87. code: ress.code
  88. })
  89. .then((res) => {
  90. uni.hideLoading();
  91. if (res.errno === 0) {
  92. console.log(res.data);
  93. this.setData({
  94. orders: res.data.orders
  95. });
  96. } else {
  97. this.setData({
  98. orders: []
  99. });
  100. uni.showToast({
  101. title: res.errmsg,
  102. icon: 'none'
  103. });
  104. }
  105. })
  106. .catch((res) => {
  107. uni.hideLoading();
  108. util.showErrorToast(res.errmsg);
  109. });
  110. });
  111. },
  112. goAppoint(e) {
  113. let sku = e.currentTarget.dataset.sku;
  114. let coupon = e.currentTarget.dataset.coupon;
  115. let orderId = e.currentTarget.dataset.orderid;
  116. let amount = e.currentTarget.dataset.amount;
  117. let dySku = e.currentTarget.dataset.dysku;
  118. let isSave=e.currentTarget.dataset.issave;
  119. let jzorderid=e.currentTarget.dataset.jzorderid;
  120. if(isSave){
  121. uni.navigateTo({
  122. url: '/pages/ucenter/orderDetail/orderDetail?id=' + jzorderid
  123. });
  124. }else{
  125. uni.navigateTo({
  126. url: '/pages/ucenter/appointOrder/appointOrder?certificateId=' + coupon + '&goodsId=' + sku + '&dyOrderId=' + orderId + '&amount=' + amount + '&dySku=' + dySku
  127. });
  128. }
  129. },
  130. goLogin() {
  131. uni.navigateTo({
  132. url: '/pages/auth/login/login'
  133. });
  134. }
  135. }
  136. };
  137. </script>
  138. <style>
  139. page {
  140. background: #f4f4f4;
  141. }
  142. .container {
  143. padding: 20rpx;
  144. width: 750rpx;
  145. background: #f4f4f4;
  146. }
  147. .process {
  148. width: 710rpx;
  149. height: 76rpx;
  150. background: #F9D9CC;
  151. border-radius: 76rpx;
  152. font-size: 30rpx;
  153. color: #191919;
  154. margin-bottom: 24rpx;
  155. display: flex;
  156. align-items: center;
  157. padding-left: 32rpx;
  158. }
  159. .process text {
  160. margin-left: 16rpx;
  161. }
  162. .item {
  163. width: 710rpx;
  164. margin: 0 0 24rpx;
  165. background: #ffffff;
  166. border-radius: 6rpx;
  167. margin-bottom: 10px;
  168. padding: 38rpx 22rpx 0 36rpx;
  169. }
  170. .item-main {
  171. display: flex;
  172. padding-bottom: 34rpx;
  173. position: relative;
  174. }
  175. .item-left {
  176. width: 128rpx;
  177. height: 128rpx;
  178. border-radius: 8rpx;
  179. border: 1rpx solid #f0f0f0;
  180. overflow: hidden;
  181. margin-right: 30rpx;
  182. }
  183. .item-left image {
  184. width: 128rpx;
  185. height: 128rpx;
  186. }
  187. .item-center {
  188. flex: 1;
  189. }
  190. .goods-name {
  191. color: #333333;
  192. line-height: 40rpx;
  193. font-size: 28rpx;
  194. width: 400rpx;
  195. display: -webkit-box;
  196. -webkit-box-orient: vertical;
  197. -webkit-line-clamp: 2;
  198. text-overflow: ellipsis;
  199. overflow: hidden;
  200. }
  201. .goods-time {
  202. color: #999999;
  203. line-height: 32rpx;
  204. /* height: 32rpx; */
  205. margin: 10rpx 0;
  206. font-size: 24rpx;
  207. white-space: nowrap;
  208. }
  209. .service-times {
  210. color: #333333;
  211. line-height: 32rpx;
  212. height: 32rpx;
  213. font-size: 24rpx;
  214. }
  215. .status-btn {
  216. width: 82rpx;
  217. height: 34rpx;
  218. line-height: 34rpx;
  219. background: #ffffff;
  220. border-radius: 4rpx;
  221. border: 1rpx solid #FF4600;
  222. color: #FF4600;
  223. font-size: 22rpx;
  224. text-align: center;
  225. margin-left: 24rpx;
  226. position: absolute;
  227. right: 0;
  228. top: 0;
  229. }
  230. .item-bottom {
  231. height: 90rpx;
  232. line-height: 90rpx;
  233. color: #FF4600;
  234. font-size: 28rpx;
  235. font-weight: bold;
  236. border-top: 1rpx solid #ededed;
  237. text-align: center;
  238. }
  239. .title {
  240. line-height: 32px;
  241. font-weight: 600;
  242. font-size: 18px;
  243. }
  244. .left {
  245. border-top-right-radius: 10px;
  246. border-bottom-right-radius: 10px;
  247. padding: 20px 0px 10px 10px;
  248. }
  249. .right {
  250. /* border-top-left-radius: 10px;
  251. border-bottom-left-radius: 10px; */
  252. padding: 10px;
  253. /* align-items: center; */
  254. display: flex;
  255. text-align: right;
  256. border-top: 1px dotted #999;
  257. justify-content: flex-end;
  258. }
  259. .btn {
  260. line-height: 32px;
  261. background-color: #a5c91d;
  262. color: white;
  263. border-radius: 5px;
  264. height: 32px;
  265. width: 76px;
  266. text-align: center;
  267. }
  268. .desc {
  269. color: #999;
  270. }
  271. .noHave {
  272. text-align: center;
  273. padding: 20rpx 50px 10px;
  274. color: #ccc;
  275. font-size: 28rpx;
  276. }
  277. .top-title{
  278. height: 46rpx;
  279. font-size: 32rpx;
  280. font-weight: 600;
  281. color: #191919;
  282. line-height: 46rpx;
  283. margin-bottom:10rpx;
  284. }
  285. .sub-title{
  286. height: 38rpx;
  287. font-size: 26rpx;
  288. color: #ACADB1;
  289. line-height: 38rpx;
  290. margin-bottom:20rpx;
  291. }
  292. .fresh-block{
  293. padding:150rpx 0;
  294. text-align: center;
  295. font-size: 26rpx;
  296. color:#ccc;
  297. }
  298. .fresh-block .fresh-text{
  299. color: #09AFFF;
  300. margin-left:8rpx;
  301. }
  302. </style>