myOrder.vue 9.3 KB

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