myorder.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  1. <template>
  2. <view class="box">
  3. <view class="tab">
  4. <view class="tabLine" :class="{tabActive:tabIndex==6}" @click="tabClick(6)">全部</view>
  5. <view class="tabLine" :class="{tabActive:tabIndex==1}" @click="tabClick(1)">待付款</view>
  6. <view class="tabLine" :class="{tabActive:tabIndex==2}" @click="tabClick(2)">待确认</view>
  7. <view class="tabLine" :class="{tabActive:tabIndex==3}" @click="tabClick(3)">待收货</view>
  8. <view class="tabLine" :class="{tabActive:tabIndex==4}" @click="tabClick(4)">待服务</view>
  9. <view class="tabLine" :class="{tabActive:tabIndex==5}" @click="tabClick(5)">待评价</view>
  10. </view>
  11. <view class="main">
  12. <view class="itemBg" v-for="(item,index) in items" @click="goDetail(item.ID)">
  13. <view class="itemTop">
  14. <view style="color: #999999; font-size: 24rpx;">保养订单</view>
  15. <view class="itemSheetState" v-if="item.SheetState==1">待付款</view>
  16. <view class="itemSheetState" v-if="item.SheetState==2">待确定</view>
  17. <view class="itemSheetState" v-if="item.SheetState==3">待收货</view>
  18. <view class="itemSheetState" v-if="item.SheetState==4">待服务</view>
  19. <view class="itemSheetState" v-if="item.SheetState==5">已完成</view>
  20. <view class="itemSheetState" v-if="item.SheetState==0">已取消</view>
  21. </view>
  22. <view class="itemShopBg">
  23. <view class="shopName">{{item.ShopName}}</view>
  24. <view class="price">¥{{item.raleMoney}}</view>
  25. </view>
  26. <view class="itemName">{{item.itemNameList}}</view>
  27. <view class="itemName">{{item.goodNameList}}</view>
  28. <view class="plateNumber">{{item.PlateNumber}}</view>
  29. <view class="itemLineBottom">
  30. <view class="itemBtn2" v-if="item.SheetState==1" @click.stop="orderPay(item)">立即支付</view>
  31. <!-- ChangeState 更换门店:1待处理2更换成功3更换关闭 3的不展示 -->
  32. <view class="orderState" v-if="item.ChangeState==1">更换门店中</view>
  33. <view class="orderState" v-if="item.ChangeState==2">更换成功</view>
  34. <!-- ServiceState 退款申请:1待处理2退款成功3退款关闭 3的不展示 -->
  35. <view class="orderState" v-if="item.ServiceState==1">更换门店中</view>
  36. <view class="orderState" v-if="item.ServiceState==2">更换成功</view>
  37. <view class="itemBtn2" v-if="item.SheetState==5&&item.EvaluateState==0"
  38. @click.stop="goEvaluate(item)">
  39. 立即评价</view>
  40. <view class="itemBtn1" v-if="item.SheetState==5&&item.EvaluateState==1"
  41. @click.stop="gopingjia(item)">
  42. 查看评价</view>
  43. </view>
  44. </view>
  45. <nodata v-show="items==''&&isload"></nodata>
  46. </view>
  47. </view>
  48. </template>
  49. <script>
  50. import nodata from '@/components/nodata/nodata.vue'
  51. export default {
  52. components: {
  53. nodata
  54. },
  55. data() {
  56. return {
  57. page: 1,
  58. tabIndex: '',
  59. items: [],
  60. isload: false,
  61. }
  62. },
  63. onLoad(opt) {
  64. this.tabIndex = opt.num;
  65. this.getData()
  66. },
  67. onShow() {
  68. console.log(this.tabIndex)
  69. this.getData()
  70. },
  71. methods: {
  72. goEvaluate(item) {
  73. uni.navigateTo({
  74. url: 'evaluate?shopID=' + item.ShopID + '&sheetID=' + item.ID
  75. })
  76. },
  77. gopingjia(item) {
  78. uni.navigateTo({
  79. url: '../me/myAppraiseDetail?id=' + item.ID
  80. })
  81. },
  82. tabClick(num) {
  83. this.tabIndex = num;
  84. this.page = 1;
  85. this.getData()
  86. },
  87. goDetail(id) {
  88. uni.navigateTo({
  89. url: 'orderDetail?id=' + id
  90. })
  91. },
  92. getData() {
  93. uni.showLoading({
  94. title: '加载中'
  95. });
  96. this.isload = false;
  97. if (this.tabIndex == 6) {
  98. var padata = {
  99. page: this.page,
  100. limit: 10,
  101. }
  102. } else {
  103. if (this.tabIndex == 5) {
  104. var padata = {
  105. page: this.page,
  106. limit: 10,
  107. evaluateState: '待评价'
  108. }
  109. } else {
  110. var padata = {
  111. page: this.page,
  112. limit: 10,
  113. state: this.tabIndex
  114. }
  115. }
  116. }
  117. this.$http('worldKeepCar/keepCarMy/listMiNiTMSheetPage', padata, 'GET').then(res => {
  118. uni.hideLoading();
  119. this.isload = true;
  120. var list = res.data.Items;
  121. if (this.page == 1) {
  122. this.items = list
  123. } else {
  124. this.items = this.items.concat(list)
  125. }
  126. })
  127. },
  128. orderPay(item) {
  129. uni.showLoading({});
  130. this.$http('miniApp/maintainOrder/orderPay', {
  131. sheetID: item.ID
  132. }, 'POST').then(res => {
  133. uni.hideLoading();
  134. var payInfo = JSON.parse(res.data.payInfo)
  135. uni.requestPayment({
  136. provider: 'wxpay',
  137. // timeStamp: String(Date.now()),
  138. timeStamp: payInfo.timeStamp,
  139. nonceStr: payInfo.nonceStr,
  140. package: payInfo.package,
  141. signType: payInfo.signType,
  142. paySign: payInfo.paySign,
  143. success: function(res) {
  144. console.log('success:' + JSON.stringify(res));
  145. uni.showToast({
  146. title: '支付成功',
  147. icon: 'none',
  148. duration: 2000
  149. });
  150. uni.switchTab({
  151. url: '../index/index'
  152. })
  153. },
  154. fail: function(err) {
  155. console.log('fail:' + JSON.stringify(err));
  156. }
  157. });
  158. })
  159. },
  160. },
  161. onReachBottom() {
  162. this.page++;
  163. this.getData()
  164. },
  165. onPullDownRefresh() {
  166. this.page = 1;
  167. this.getData()
  168. setTimeout(function() {
  169. uni.stopPullDownRefresh();
  170. }, 1000);
  171. }
  172. }
  173. </script>
  174. <style scoped>
  175. .box {
  176. min-height: 100vh;
  177. background: #F4F5F7;
  178. }
  179. .tab {
  180. background: #FFFFFF;
  181. display: flex;
  182. justify-content: space-between;
  183. line-height: 92rpx;
  184. position: fixed;
  185. width: 100%;
  186. height: 92rpx;
  187. z-index: 11;
  188. }
  189. .tabLine {
  190. width: 180rpx;
  191. text-align: center;
  192. }
  193. .tabActive {
  194. color: #FF4F00;
  195. border-bottom: 4rpx solid #FF4F00;
  196. }
  197. .main {
  198. padding-top: 92rpx;
  199. padding-bottom: 20rpx;
  200. background-color: #F4F5F7;
  201. }
  202. .itemBg {
  203. margin: 20rpx 24rpx;
  204. background-color: #FFFFFF;
  205. border-radius: 10rpx;
  206. padding: 20rpx;
  207. }
  208. .itemTop {
  209. display: flex;
  210. justify-content: space-between;
  211. }
  212. .itemSheetState {
  213. font-size: 24rpx;
  214. color: #FF2400
  215. }
  216. .itemShopBg {
  217. display: flex;
  218. justify-content: space-between;
  219. margin: 20rpx 0;
  220. }
  221. .shopName {
  222. color: #333333;
  223. font-size: 30rpx;
  224. }
  225. .price {
  226. color: #333333;
  227. font-size: 32rpx;
  228. }
  229. .itemName {
  230. color: #666666;
  231. font-size: 24rpx;
  232. height: 30rpx;
  233. overflow: hidden;
  234. text-overflow: ellipsis;
  235. white-space: nowrap;
  236. }
  237. .plateNumber {
  238. color: #666666;
  239. font-size: 24rpx;
  240. margin: 15rpx 0 20rpx;
  241. }
  242. .itemLineBottom {
  243. display: flex;
  244. justify-content: flex-end;
  245. }
  246. .itemBtn1 {
  247. width: 150rpx;
  248. height: 56rpx;
  249. border-radius: 36rpx;
  250. border: 2rpx solid #DDDDDD;
  251. text-align: center;
  252. line-height: 56rpx;
  253. font-size: 28rpx;
  254. color: #3C3C3C;
  255. margin-left: 40rpx;
  256. }
  257. .itemBtn2 {
  258. width: 150rpx;
  259. height: 56rpx;
  260. border-radius: 36rpx;
  261. border: 2rpx solid #FF4F00;
  262. text-align: center;
  263. line-height: 56rpx;
  264. font-size: 28rpx;
  265. color: #FF4F00;
  266. margin-left: 40rpx;
  267. }
  268. </style>