myOrder.vue 8.9 KB

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