myTimes - 副本.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343
  1. <template>
  2. <view class="container">
  3. <tui-tabs :top="0" :tabs="statusType" :isFixed="scrollTop>=0" :currentTab="currentTab" selectedColor="#E41F19"
  4. sliderBgColor="#E41F19" @change="statusTap" itemWidth="20%"></tui-tabs>
  5. <!--选项卡逻辑自己实现即可,此处未做处理-->
  6. <view :class="{'tui-order-list':scrollTop>=0}">
  7. <view class="tui-order-item" v-for="(item,orderIndex) in orderList" :key="orderIndex">
  8. <tui-list-cell :hover="false" :lineLeft="false">
  9. <view class="tui-goods-title">
  10. <view>订单号:{{item.order_num_alias}}</view>
  11. <view class="tui-order-status">{{item.statusStr}}</view>
  12. </view>
  13. </tui-list-cell>
  14. <block v-for="(goodsitem,index) in item.goodsMap" :key="index">
  15. <tui-list-cell padding="0" @click="orderDetail(item.id)">
  16. <view class="tui-goods-item">
  17. <image :src="goodsitem.image" class="tui-goods-img" mode="widthFix"></image>
  18. <view class="tui-goods-center">
  19. <view class="tui-goods-name">{{goodsitem.name}}</view>
  20. <view v-if="goodsitem.label" class="tui-goods-attr">{{goodsitem.label}}</view>
  21. <view v-if="index ==0" class="tui-goods-attr">次卡:{{item.timesmum}}次,剩余:{{item.remain}}次</view>
  22. <view v-if="index ==0 && item.timeslabel" class="tui-goods-attr">{{item.timeslabel}}
  23. </view>
  24. </view>
  25. <view class="tui-price-right">
  26. <view>¥{{goodsitem.price}}</view>
  27. <view>x{{goodsitem.quantity}}</view>
  28. </view>
  29. </view>
  30. </tui-list-cell>
  31. </block>
  32. <tui-list-cell :hover="false" unlined>
  33. <view class="tui-goods-price">
  34. <view>
  35. <!--共4件商品--> 合计:
  36. </view>
  37. <view class="tui-size-24">¥</view>
  38. <view class="tui-price-large">{{item.total}}</view>
  39. <view class="tui-size-24"></view>
  40. </view>
  41. </tui-list-cell>
  42. <view class="tui-order-btn">
  43. <view v-if="item.order_status_id==1" class="tui-btn-ml">
  44. <tui-button @click="cancelOrderTap(item.id)" type="black" plain width="152rpx" height="56rpx"
  45. :size="26" shape="circle">取消订单</tui-button>
  46. </view>
  47. <view v-if="item.order_status_id==2 && item.is_times==1 && item.timesmum>0 && item.is_timing==1" class="tui-btn-ml">
  48. <tui-button @click="yuyueTime(item.id)" type="black" plain width="152rpx" height="56rpx"
  49. :size="26" shape="circle">预约时间</tui-button>
  50. </view>
  51. <view class="tui-btn-ml">
  52. <tui-button @click="orderDetail(item.id)" type="black" plain width="152rpx" height="56rpx"
  53. :size="26" shape="circle">详情</tui-button>
  54. </view>
  55. <view v-if="item.paymethod.code=='offline_pay' && item.is_offline_pay<1 && item.order_status_id==1"
  56. class="tui-btn-ml">
  57. <tui-button type="black" plain width="152rpx" height="56rpx" :size="26" shape="circle"
  58. @click="offlinepaymentTap(item.id)">支付凭证</tui-button>
  59. </view>
  60. <view v-if="item.paymethod.code=='wx_pay' && item.order_status_id==1" class="tui-btn-ml">
  61. <tui-button type="danger" plain width="152rpx" height="56rpx" :size="26" shape="circle"
  62. @click="toPayTap(item.total,item.id)">立即支付</tui-button>
  63. </view>
  64. </view>
  65. </view>
  66. </view>
  67. <!--加载loadding-->
  68. <tui-loadmore v-if="loadding" :index="3" type="red"></tui-loadmore>
  69. <tui-nomore v-if="!pullUpOn" backgroundColor="#fafafa"></tui-nomore>
  70. <!--加载loadding-->
  71. </view>
  72. </template>
  73. <script>
  74. import pay from '@/common/pay.js'
  75. export default {
  76. data() {
  77. return {
  78. tabBar: [],
  79. statusType: [],
  80. ptype: 2,
  81. currentType: 0,
  82. currentTab: 0,
  83. pageIndex: 1,
  84. loadding: false,
  85. pullUpOn: true,
  86. scrollTop: 0,
  87. orderList: [],
  88. where: {
  89. status: 0,
  90. ptype:0,
  91. is_times:1,
  92. keyword: '',
  93. page: 1,
  94. limit: 10,
  95. },
  96. }
  97. },
  98. onLoad: function(e) {
  99. let _this = this
  100. if(e.currentTab){
  101. _this.currentTab = e.currentTab;
  102. }
  103. _this.$request.get('orderstatus.listname', {
  104. ptype: _this.ptype,
  105. samkey: (new Date()).valueOf(),
  106. }).then(res => {
  107. if (res.errno == 0) {
  108. _this.statusType = res.data;
  109. _this.currentType = _this.statusType[_this.currentTab].id;
  110. }
  111. })
  112. },
  113. onShow: function(e) {
  114. this.getorderlist(true);
  115. },
  116. methods: {
  117. statusTap: function(e) {
  118. this.currentTab = e.index
  119. this.currentType = this.statusType[this.currentTab].id;
  120. this.getorderlist(true);
  121. },
  122. getorderlist: function(isPage) {
  123. var _this = this
  124. console.log(_this.loadend);
  125. if (_this.loading) return;
  126. if (isPage === true) {
  127. _this.where.page = 1;
  128. _this.orderList = [];
  129. }else{
  130. if (_this.loadend) return;
  131. }
  132. _this.where.samkey = (new Date()).valueOf();
  133. _this.where.ptype = _this.ptype;
  134. _this.where.status = _this.currentType;
  135. //console.log(_this.where);
  136. _this.$request.post('order.myorder', _this.where).then(res => {
  137. if (res.errno == 0) {
  138. _this.orderList = _this.orderList.concat(res.data.data);
  139. _this.where.page = _this.where.page + 1
  140. _this.loadend = _this.orderList.length < _this.where.limit;
  141. }
  142. _this.loading = false;
  143. })
  144. },
  145. toPayTap: function(total, orderid) {
  146. const redirectUrl = "/pagesA/my/myOrder/myTimes";
  147. pay.wxpay('order', total, orderid, redirectUrl);
  148. },
  149. cancelOrderTap: function(orderid) {
  150. var _this = this;
  151. uni.showModal({
  152. title: '确定要取消该订单吗?',
  153. content: '',
  154. success: function(res) {
  155. if (res.confirm) {
  156. _this.$request.post('order.cancel', {
  157. orderid: orderid
  158. }).then(res => {
  159. if (res.errno == 0) {
  160. _this.getorderlist();
  161. }
  162. })
  163. }
  164. }
  165. })
  166. },
  167. yuyueTime(orderid) {
  168. this.tui.href("/pagesA/my/myOrder/yuyuetime?id=" + orderid)
  169. },
  170. orderDetail: function(orderid) {
  171. var url = '/pagesA/my/myOrder/myTimesDetail?id=' + orderid;
  172. uni.navigateTo({
  173. url: url
  174. })
  175. },
  176. //线下付款处理
  177. offlinepaymentTap: function(orderid) {
  178. uni.navigateTo({
  179. url: '/pagesA/submitOrder/offlinepayment?id=' + orderid
  180. })
  181. },
  182. invoiceDetail() {
  183. this.tui.href('/pagesA/my/invoiceDetail/invoiceDetail')
  184. },
  185. addEvaluate() {
  186. this.tui.href('/pagesA/my/addEvaluate/addEvaluate')
  187. }
  188. },
  189. /**
  190. * 页面相关事件处理函数--监听用户下拉动作
  191. */
  192. onPullDownRefresh: function() {
  193. this.where.page = 1;
  194. this.loadend = false;
  195. this.orderList = [];
  196. this.getorderlist();
  197. setTimeout(() => {
  198. uni.stopPullDownRefresh()
  199. }, 200);
  200. },
  201. /**
  202. * 页面上拉触底事件的处理函数
  203. */
  204. onReachBottom() {
  205. //只是测试效果,逻辑以实际数据为准
  206. this.loadding = true
  207. this.pullUpOn = true
  208. this.getorderlist();
  209. setTimeout(() => {
  210. this.loadding = false
  211. this.pullUpOn = false
  212. }, 1000)
  213. },
  214. onPageScroll(e) {
  215. this.scrollTop = e.scrollTop;
  216. }
  217. }
  218. </script>
  219. <style>
  220. .container {
  221. padding-bottom: env(safe-area-inset-bottom);
  222. }
  223. .tui-order-list {
  224. margin-top: 80rpx;
  225. }
  226. .tui-order-item {
  227. margin-top: 20rpx;
  228. border-radius: 10rpx;
  229. overflow: hidden;
  230. }
  231. .tui-goods-title {
  232. width: 100%;
  233. font-size: 28rpx;
  234. display: flex;
  235. align-items: center;
  236. justify-content: space-between;
  237. }
  238. .tui-order-status {
  239. color: #888;
  240. font-size: 26rpx;
  241. }
  242. .tui-goods-item {
  243. width: 100%;
  244. padding: 20rpx 30rpx;
  245. box-sizing: border-box;
  246. display: flex;
  247. justify-content: space-between;
  248. }
  249. .tui-goods-img {
  250. width: 180rpx;
  251. height: 180rpx;
  252. display: block;
  253. flex-shrink: 0;
  254. }
  255. .tui-goods-center {
  256. flex: 1;
  257. padding: 20rpx 8rpx;
  258. box-sizing: border-box;
  259. }
  260. .tui-goods-name {
  261. max-width: 310rpx;
  262. word-break: break-all;
  263. overflow: hidden;
  264. text-overflow: ellipsis;
  265. display: -webkit-box;
  266. -webkit-box-orient: vertical;
  267. -webkit-line-clamp: 2;
  268. font-size: 26rpx;
  269. line-height: 32rpx;
  270. }
  271. .tui-goods-attr {
  272. font-size: 22rpx;
  273. color: #888888;
  274. line-height: 20rpx;
  275. padding-top: 18rpx;
  276. word-break: break-all;
  277. overflow: hidden;
  278. text-overflow: ellipsis;
  279. display: -webkit-box;
  280. -webkit-box-orient: vertical;
  281. -webkit-line-clamp: 2;
  282. }
  283. .tui-price-right {
  284. text-align: right;
  285. font-size: 24rpx;
  286. color: #888888;
  287. line-height: 30rpx;
  288. padding-top: 20rpx;
  289. }
  290. .tui-color-red {
  291. color: #E41F19;
  292. padding-right: 30rpx;
  293. }
  294. .tui-goods-price {
  295. width: 100%;
  296. display: flex;
  297. align-items: flex-end;
  298. justify-content: flex-end;
  299. font-size: 24rpx;
  300. }
  301. .tui-size-24 {
  302. font-size: 24rpx;
  303. line-height: 24rpx;
  304. }
  305. .tui-price-large {
  306. font-size: 32rpx;
  307. line-height: 30rpx;
  308. font-weight: 500;
  309. }
  310. .tui-order-btn {
  311. width: 100%;
  312. display: flex;
  313. align-items: center;
  314. justify-content: flex-end;
  315. background: #fff;
  316. padding: 10rpx 30rpx 20rpx;
  317. box-sizing: border-box;
  318. }
  319. .tui-btn-ml {
  320. margin-left: 20rpx;
  321. }
  322. </style>