myOrder.vue 8.2 KB

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