myOrder.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386
  1. <template>
  2. <view class="container">
  3. <topNavBar title="全部订单" />
  4. <!-- 订单状态区 -->
  5. <view class="state-area dflex navbar-area bg-main">
  6. <view class="nav-item dflex-c pos-r fs h-full" :class="{ active: tabCurrentIndex === index }"
  7. v-for="(item, index) in navList" :key="index" @click="tabClick(index)">
  8. {{ item.state }}
  9. </view>
  10. </view>
  11. <!-- </scroll-view> -->
  12. <!-- 订单轮播区 -->
  13. <swiper class="swiper-area w-full" :duration="0" :current="tabCurrentIndex" @change="changeTab">
  14. <!-- 轮播项对应订单状态 -->
  15. <swiper-item class="tab-content wh-full" v-for="(tabItem, tabIndex) in navList" :key="tabIndex">
  16. <!-- 滚动区 -->
  17. <scroll-view class="h-full" scroll-y @scrolltolower="loadData">
  18. <!-- 空白页 -->
  19. <use-empty v-if="tabItem.orderList.length === 0 && tabItem.loaded" e-style="round" e-type="cart"
  20. tip="订单数据为空" height="93vh"></use-empty>
  21. <!-- 订单列表区 -->
  22. <view class="margin-bottom-sm" :class="index === 0 ? 'padding-top-sm' : ''"
  23. v-for="(item, index) in tabItem.orderList" :key="index">
  24. <!-- 订单项 -->
  25. <view class="order-item padding bg-main border-radius">
  26. <view @click="todetail(item)">
  27. <view class="dflex-b padding-bottom-sm">
  28. <view class="fs-xs fwb dflex">
  29. <u-tag :text="item.pickupInfo.pickupType ? '堂食' : '打包'" size="mini"
  30. bgColor="#FFF4E4" color="#F5821F" shape="circle"
  31. borderColor="#FFF4E4"></u-tag>
  32. 订单编号:{{ item.orderId }}
  33. </view>
  34. <text class="fs-xs active">
  35. <text v-if="item.status == 'TRADE_NO_CREATE_PAY'">待付款</text>
  36. <text v-else>已完成</text>
  37. </text>
  38. </view>
  39. <!-- 订单商品明细 -->
  40. <view class="goods-area dflex-b">
  41. <view class="pic-list dflex">
  42. <view v-for="(i, gindex) in item.orderItemVoList" :key="gindex"
  43. class="margin-right-sm">
  44. <image v-if="i.picUrl" mode="aspectFit" class="wh-full" :src="i.picUrl">
  45. </image>
  46. <view v-else class="pic"></view>
  47. </view>
  48. </view>
  49. <view class="next-detail">
  50. <text v-if="item.orderItemVoList">共{{item.orderItemVoList.length}}件</text>
  51. <u-icon name="arrow-right" size="20"></u-icon>
  52. </view>
  53. </view>
  54. <!-- 实付款 -->
  55. <view class="dflex-e padding-top-sm">
  56. <text class="fs-xs margin-right-xs"
  57. v-if="item.orderItemVoList">共{{item.orderItemVoList.length}}份商品</text>
  58. <text class="fs-xs margin-right-xs">实付</text>
  59. <text class="price ft-main">{{ item.payAmount}}</text>
  60. </view>
  61. </view>
  62. <!-- 订单操作区 -->
  63. <view class="dflex-b margin-top-sm">
  64. <view>
  65. <text class="ft-dark">更多</text>
  66. </view>
  67. <view class="dflex-e">
  68. <view class="dflex">
  69. <button class="action-btn border-radius-big bg-main">取消订单</button>
  70. <button class="action-btn border-radius-big bg-main"
  71. @click="todetail(item)">订单详情</button>
  72. <button class="action-btn border-radius-big bg-main main-btn"
  73. @click="todetail(item)">去支付</button>
  74. </view>
  75. </view>
  76. </view>
  77. </view>
  78. </view>
  79. <!-- 上拉加载更多 -->
  80. <use-loadmore v-if="tabItem.orderList.length > 0 && tabItem.loaded && tabItem.hasmore"
  81. :type="tabItem.loadingType"></use-loadmore>
  82. </scroll-view>
  83. </swiper-item>
  84. </swiper>
  85. </view>
  86. </template>
  87. <script>
  88. export default {
  89. data() {
  90. return {
  91. tabCurrentIndex: 0,
  92. navData: {},
  93. navList: [{
  94. id: 0,
  95. state: '全部',
  96. loadingType: 'more',
  97. orderList: [{
  98. order_detail: [{
  99. goods_img: '../../../static/x2.jpg',
  100. goods_name: '商品1',
  101. goods_name_pw: '小标题',
  102. goods_num: 1,
  103. goods_sku_name: 60,
  104. goods_price: 10
  105. }],
  106. order: {
  107. order_actural_paid: 10,
  108. order_refund_state: '处理中',
  109. state: '待发货'
  110. }
  111. },
  112. {
  113. order_detail: [{
  114. goods_img: '../../../static/x2.jpg',
  115. goods_name: '商品1',
  116. goods_name_pw: '小标题',
  117. goods_num: 1,
  118. goods_sku_name: 60,
  119. goods_price: 10
  120. }],
  121. order: {
  122. order_actural_paid: 10,
  123. state: '待发货'
  124. }
  125. }
  126. ]
  127. },
  128. {
  129. id: 1,
  130. state: '待付款',
  131. loadingType: 'more',
  132. orderList: []
  133. },
  134. {
  135. id: 2,
  136. state: '待核销',
  137. loadingType: 'more',
  138. orderList: []
  139. },
  140. {
  141. id: 3,
  142. state: '已取消',
  143. loadingType: 'more',
  144. orderList: []
  145. },
  146. {
  147. id: 4,
  148. state: '已完成',
  149. loadingType: 'more',
  150. orderList: []
  151. }
  152. ],
  153. reqdata: {
  154. page: 1,
  155. rows: 10
  156. },
  157. scrollLeft: 0,
  158. title: '全部'
  159. }
  160. },
  161. onLoad(e) {
  162. this.tabCurrentIndex = parseFloat(e.type);
  163. this.fatchDate()
  164. },
  165. methods: {
  166. async fatchDate() {
  167. const e = uni.getStorageSync('carl')
  168. const params = {
  169. storeId: e.id
  170. }
  171. const result = await this.$request('get', '/order/tradeOrder/queryTradeOrder', params)
  172. if (result) {
  173. console.log('result', result.rows)
  174. this.navList[0].orderList = result.rows
  175. console.log('orderList', this.navList[0].orderList)
  176. this.navList[1].orderList = result.rows.filter(item => item.status == 'TRADE_NO_CREATE_PAY');
  177. }
  178. },
  179. loadData() {},
  180. // swiper 切换
  181. changeTab(e) {
  182. this.tabCurrentIndex = e.target.current;
  183. },
  184. //顶部tab点击
  185. tabClick(index) {
  186. this.tabCurrentIndex = index;
  187. },
  188. // 点击跳转详情页面
  189. todetail(order) {
  190. console.log('order', order)
  191. // uni.navigateTo({
  192. // url: `/pages/user/order/order-detail?order_id=${order.order_id}`
  193. // });
  194. uni.navigateTo({
  195. url: `/pages/order/orderPaid/orderPaid?id=${order.orderId}`
  196. });
  197. },
  198. // 立即支付
  199. payment(order) {
  200. },
  201. // 删除订单
  202. delOrder(item) {
  203. let _this = this;
  204. uni.showModal({
  205. title: '提示',
  206. content: '删除订单',
  207. success: function(res) {
  208. if (res.confirm) {
  209. uni.showLoading({
  210. title: '请稍后'
  211. });
  212. } else if (res.cancel) {
  213. console.log('点击取消');
  214. }
  215. },
  216. complete() {
  217. uni.hideLoading();
  218. }
  219. });
  220. },
  221. // 取消订单
  222. cancelOrder(item) {
  223. let _this = this;
  224. uni.showModal({
  225. title: '提示',
  226. content: '取消订单',
  227. success: function(res) {
  228. if (res.confirm) {
  229. uni.showLoading({
  230. title: '请稍后'
  231. });
  232. } else if (res.cancel) {
  233. console.log('用户点击取消');
  234. }
  235. },
  236. complete() {
  237. uni.hideLoading();
  238. }
  239. });
  240. },
  241. // 申请退款
  242. torefund(data) {
  243. },
  244. // 评价
  245. toevaluate(item) {
  246. }
  247. }
  248. }
  249. </script>
  250. <style lang="scss">
  251. page,
  252. .container {
  253. min-height: 100%;
  254. background: $page-color-base;
  255. }
  256. /* 订单状态区 */
  257. .navbar-area {
  258. white-space: nowrap;
  259. }
  260. .state-area {
  261. height: 7vh;
  262. box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
  263. z-index: 10;
  264. top: 0;
  265. }
  266. .nav-item {
  267. flex: 1;
  268. &.active {
  269. &:after {
  270. content: '';
  271. position: absolute;
  272. left: 50%;
  273. transform: translate(-50%);
  274. bottom: 0;
  275. width: 44px;
  276. height: 0;
  277. border-bottom: 2px solid $base-color;
  278. }
  279. }
  280. }
  281. /* 订单轮播区 */
  282. .swiper-area {
  283. height: 93vh;
  284. }
  285. /* 订单区 */
  286. .order-area {}
  287. /* 订单项 */
  288. .order-item {
  289. /* 订单商品明细区 */
  290. .goods-area {
  291. display: flex;
  292. image {
  293. width: 180rpx;
  294. height: 180rpx;
  295. }
  296. .right {
  297. padding: 0 30upx 0 24upx;
  298. overflow: hidden;
  299. .attr-box {
  300. font-size: $font-sm + 2upx;
  301. color: $font-color-light;
  302. padding: 10upx 12upx;
  303. }
  304. }
  305. }
  306. /* 操作按钮 */
  307. .action-btn {
  308. width: 156rpx;
  309. height: inherit;
  310. line-height: inherit;
  311. margin: 0;
  312. margin-left: 20rpx;
  313. padding: 12rpx 0;
  314. font-size: $font-sm + 2upx;
  315. color: $font-color-dark;
  316. /* #ifdef MP-QQ || MP-ALIPAY */
  317. border: 1px solid;
  318. /* #endif */
  319. &:after {
  320. border-radius: 100px;
  321. }
  322. &.main-btn {
  323. background: #fff9f9;
  324. color: $base-color;
  325. &:after {
  326. border-color: #f7bcc8;
  327. }
  328. }
  329. }
  330. }
  331. .pic-list {
  332. width: calc(100% - 130upx);
  333. .pic {
  334. margin-right: 20upx;
  335. height: 160rpx;
  336. width: 160rpx;
  337. background-color: #EEE;
  338. }
  339. .pic:last-child {
  340. margin: 0;
  341. }
  342. }
  343. .next-detail {
  344. width: 130upx;
  345. display: flex;
  346. justify-content: flex-end;
  347. align-items: center;
  348. }
  349. </style>