list.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341
  1. <template>
  2. <view class="container padding-lr-sm">
  3. <use-tabbar :tabbar="false"></use-tabbar>
  4. <u-tabs :current="data.status" :list="tab" @click="click" lineColor="#f56c6c"
  5. :activeStyle="{
  6. color: '#303133',
  7. fontWeight: 'bold',
  8. transform: 'scale(1.05)'
  9. }"
  10. :inactiveStyle="{
  11. color: '#606266',
  12. transform: 'scale(1)'
  13. }"></u-tabs>
  14. <!-- 订单轮播区 -->
  15. <view class="order-area w-full">
  16. <!-- 空白页 -->
  17. <!--
  18. <use-empty v-if="fetch && fetch.list && fetch.list.length <= 0" e-style="round" e-type="cart" btn-tip=""
  19. tip="订单数据为空" height="88vh"></use-empty>
  20. -->
  21. <u-empty v-if="fetch && fetch.list && fetch.list.length <= 0" marginTop="200" mode="order"></u-empty>
  22. <!-- 订单列表区 -->
  23. <view v-if="fetch && fetch.list && fetch.list.length > 0" class="margin-bottom-sm" :class="index === 0 ? 'padding-top-sm' : ''"
  24. v-for="(item, index) in fetch.list" :key="index">
  25. <!-- 订单项 -->
  26. <view class="order-item padding bg-main border-radius">
  27. <view @click="toInfo(item)">
  28. <!-- 订单商品明细 -->
  29. <view class="goods-area" :class="{ 'margin-top': k > 0 }"
  30. v-for="(v, k) in item.detail" :key="k">
  31. <image :src="v.pic" mode="aspectFill"></image>
  32. <view class="right flex1">
  33. <text class="clamp-2">{{ v.name }}</text>
  34. <view class="ft-dark fs-xs padding-top-xs">
  35. <text class="margin-right">× {{v.num}}</text>
  36. {{ v.sku_name || '&nbsp;&nbsp;' }}
  37. </view>
  38. <view class="margin-top-sm">
  39. <text class="price ft-main fs-sm">{{ v.cash_text }}</text>
  40. </view>
  41. </view>
  42. </view>
  43. </view>
  44. <!-- 订单操作区 -->
  45. <view class="dflex-b margin-top-sm">
  46. <view>
  47. <!-- 当前状态 -->
  48. <u-tag :text="item.status_name" plain plainFill size="mini" :type="item.status_type" ></u-tag>
  49. </view>
  50. <view class="dflex-e">
  51. <text class="fs-xs margin-right-xs">总金额</text>
  52. <text class="price ft-main">{{ item.cash_text }}</text>
  53. </view>
  54. <!--
  55. <view class="dflex">
  56. <button class="action-btn border-radius-big bg-main main-btn"
  57. @click="toevaluate(item)">我要评价</button>
  58. </view>
  59. -->
  60. </view>
  61. </view>
  62. </view>
  63. </view>
  64. </view>
  65. </template>
  66. <script>
  67. export default {
  68. data() {
  69. return {
  70. tab: [{
  71. name: '全部',
  72. }, {
  73. name: '待付款',
  74. }, {
  75. name: '待发货'
  76. }, {
  77. name: '待收货'
  78. }, {
  79. name: '待评价'
  80. }, {
  81. name: '已完成'
  82. }],
  83. fetch: {},
  84. data: {
  85. status:0,
  86. },
  87. };
  88. },
  89. onLoad(options) {
  90. if (options.status) {
  91. this.data.status = options.status
  92. }
  93. },
  94. onShow() {
  95. this.loadData(1);
  96. },
  97. //下拉刷新
  98. onPullDownRefresh() {
  99. this.loadData(1);
  100. },
  101. //加载更多
  102. onReachBottom() {
  103. this.loadData(2);
  104. },
  105. methods: {
  106. loadData(page) {
  107. this.DeverApi.page([page, 'list'], this, 'order.list', this.data);
  108. },
  109. //顶部tab点击
  110. click(e) {
  111. this.data.status = e.index
  112. this.loadData(1);
  113. },
  114. // 点击跳转详情页面
  115. toInfo(order) {
  116. this.Dever.location('order/info?id=' + order.id);
  117. },
  118. // 立即支付
  119. payment(order) {
  120. if (order.order_pay_state == '待核实') {
  121. this.$api.msg('订单已支付待核实状态');
  122. return;
  123. }
  124. this.$api.topay({
  125. order_id: order.order_id,
  126. money: order.order_actural_paid
  127. });
  128. },
  129. // 删除订单
  130. delOrder(item) {
  131. let _this = this;
  132. uni.showModal({
  133. title: '提示',
  134. content: '删除订单',
  135. success: function(res) {
  136. if (res.confirm) {
  137. uni.showLoading({
  138. title: '请稍后'
  139. });
  140. _this.$func.usemall.call('order/deleted', {
  141. order_id: item.order.order_id,
  142. }).then(res => {
  143. if (res.code === 200) {
  144. _this.loadData('tab_change', 1);
  145. }
  146. })
  147. } else if (res.cancel) {
  148. console.log('点击取消');
  149. }
  150. },
  151. complete() {
  152. uni.hideLoading();
  153. }
  154. });
  155. },
  156. // 取消订单
  157. cancelOrder(item) {
  158. let _this = this;
  159. uni.showModal({
  160. title: '提示',
  161. content: '取消订单',
  162. success: function(res) {
  163. if (res.confirm) {
  164. uni.showLoading({
  165. title: '请稍后'
  166. });
  167. _this.$func.usemall.call('order/cancel', {
  168. order_id: item.order.order_id,
  169. state: '已取消'
  170. }).then(res => {
  171. if (res.code === 200) {
  172. _this.loadData('tab_change', 1);
  173. }
  174. })
  175. } else if (res.cancel) {
  176. console.log('用户点击取消');
  177. }
  178. },
  179. complete() {
  180. uni.hideLoading();
  181. }
  182. });
  183. },
  184. // 查看物流
  185. toexpress(item) {
  186. // this.$api.msg('查看物流开发中');
  187. uni.navigateTo({
  188. url: `/pages/user/order/order-express?order_id=${item.order.order_id}`
  189. });
  190. },
  191. // 已发货
  192. toreceipt(item) {
  193. let _this = this;
  194. uni.showModal({
  195. title: '提示',
  196. content: '确认收货',
  197. success: function(res) {
  198. if (res.confirm) {
  199. uni.showLoading({
  200. title: '请稍后'
  201. });
  202. _this.$func.usemall.call('order/received', {
  203. order_id: item.order.order_id,
  204. state: '待评价'
  205. }).then(res => {
  206. _this.loadData('tab_change', 1);
  207. });
  208. } else if (res.cancel) {
  209. console.log('用户点击取消');
  210. }
  211. },
  212. complete() {
  213. uni.hideLoading();
  214. }
  215. });
  216. },
  217. // 申请退款
  218. torefund(data) {
  219. uni.navigateTo({
  220. url: `/pages/user/order/order-refund?order_id=${data.order.order_id}`
  221. });
  222. },
  223. // 评价
  224. toevaluate(item) {
  225. uni.navigateTo({
  226. url: `/pages/user/order/order-evaluate?id=${item.order.order_id}`
  227. });
  228. }
  229. }
  230. };
  231. </script>
  232. <style lang="scss">
  233. page,
  234. .container {
  235. min-height: 100%;
  236. background: $page-color-base;
  237. }
  238. /* 订单状态区 */
  239. .navbar-area {
  240. white-space: nowrap;
  241. }
  242. .state-area {
  243. height: 7vh;
  244. box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
  245. z-index: 10;
  246. top: 0;
  247. }
  248. .nav-item {
  249. flex: 1;
  250. &.active {
  251. &:after {
  252. content: '';
  253. position: absolute;
  254. left: 50%;
  255. transform: translate(-50%);
  256. bottom: 0;
  257. width: 44px;
  258. height: 0;
  259. border-bottom: 2px solid $base-color;
  260. }
  261. }
  262. }
  263. /* 订单轮播区 */
  264. .swiper-area {
  265. height: 93vh;
  266. }
  267. /* 订单区 */
  268. .order-area {}
  269. /* 订单项 */
  270. .order-item {
  271. /* 订单商品明细区 */
  272. .goods-area {
  273. display: flex;
  274. image {
  275. width: 180rpx;
  276. height: 180rpx;
  277. }
  278. .right {
  279. padding: 0 30upx 0 24upx;
  280. overflow: hidden;
  281. .attr-box {
  282. font-size: $font-sm + 2upx;
  283. color: $font-color-light;
  284. padding: 10upx 12upx;
  285. }
  286. }
  287. }
  288. /* 操作按钮 */
  289. .action-btn {
  290. width: 156rpx;
  291. height: inherit;
  292. line-height: inherit;
  293. margin: 0;
  294. margin-left: 20rpx;
  295. padding: 12rpx 0;
  296. font-size: $font-sm + 2upx;
  297. color: $font-color-dark;
  298. /* #ifdef MP-QQ || MP-ALIPAY */
  299. border: 1px solid;
  300. /* #endif */
  301. &:after {
  302. border-radius: 100px;
  303. }
  304. &.main-btn {
  305. background: #fff9f9;
  306. color: $base-color;
  307. &:after {
  308. border-color: #f7bcc8;
  309. }
  310. }
  311. }
  312. }
  313. </style>