refuend.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. <template>
  2. <view>
  3. <scroll-view v-if="order_list.length > 0" style="height: 95vh;" class="floor-list"
  4. :scroll-top="scrollTop" scroll-y="true" @scroll="scroll" @scrolltoupper="upper" @scrolltolower="lower"
  5. :refresher-enabled="false">
  6. <view v-for="(items,index) in order_list" :key="index" class="cart-list">
  7. <view @click="goDetail(items.id)" class="shoplist" style="background-color: #fff;">
  8. <view>
  9. <van-card
  10. title-class="changewidth"
  11. price-class ="priceClass"
  12. :price="items.goods_price"
  13. :desc="items.descire+'X'+items.goods_num"
  14. :title="items.desarray"
  15. :thumb="pictureUrl + '/uploads/home/store/goods/'+items.goods_image.substr(0, items.goods_image.indexOf('\_')) + '/' + items.goods_image"
  16. >
  17. </van-card>
  18. </view>
  19. </view>
  20. <view class="topTip">
  21. <view style="font-size: 28upx;">合计:{{items.total_price}}</view>
  22. <!-- <view class="deleChange" v-if="item.order_state == 10">未付款</view>
  23. <view class="deleChange" v-if="item.order_state == 20">催单</view>
  24. <view class="deleChange" v-if="item.order_state == 20">确认收货</view> uni.navigateTo({
  25. url:`/pages/myOrder/paymoment?order_id=${order_id}&prices=${prices}`
  26. })
  27. <view class="deleChange" v-if="item.order_state == 40 && item.evaluation_state == 0">去评价</view> -->
  28. <view class="deleChange" v-if="items.status == 1" @click="gopay(item)">待处理</view>
  29. <view class="deleChange" v-if="items.status == 2" @click="gopay(item)">退款成功</view>
  30. <view class="deleChange" v-if="items.status == 3" @click="gopay(item)">退款失败</view>
  31. </view>
  32. </view>
  33. </scroll-view>
  34. <view v-if="order_list.length == 0 && successlogion && hasLogin" >
  35. <view style="margin: 120upx auto;text-align: center;">
  36. <van-icon size="160rpx" color="#909399" name="description" />
  37. <view style="text-align: center;color: #909399;"> 去买点什么</view>
  38. </view>
  39. </view>
  40. <Gobacktop @getop="getop" v-if="isTop" />
  41. <!-- <logionDialog @confirmDiaolog="confirmDiaolog" :ishow="false" @cancelDiaolog="cancelDiaolog" :showdialog="showdialog"/> -->
  42. </view>
  43. </template>
  44. <script>
  45. import {
  46. mapMutations,mapState
  47. } from 'vuex'
  48. import Dialog from '@/component/Dialog.vue'
  49. import Gobacktop from '@/component/Gobacktop.vue'
  50. export default{
  51. components: {
  52. Dialog,
  53. Gobacktop
  54. },
  55. data() {
  56. return {
  57. isTop: false,
  58. ispull: true,
  59. showdialog: false,
  60. orderCancel: false,
  61. titles:'',
  62. pictureUrl: this.pictureUrl,
  63. menu:[
  64. {name:'全部'},
  65. {name:'待支付'},
  66. {name:'处理中'},
  67. {name:'已收货'},
  68. {name:'已取消'},
  69. {name:'退款售后'}
  70. ],
  71. deleteorder: 0, // 判断删除订单还是确认收货
  72. // 要查找的订单状态 all-全部 waiting-待支付 payed-处理中 complete-已收货 cancel-已取消 refund-退款售后
  73. active: 0,
  74. scrollTop: 0,
  75. old: {
  76. scrollTop: 0
  77. },
  78. order_id:'',
  79. page: 1,
  80. page_size: 10,
  81. state: 'all',
  82. order_list:[]
  83. }
  84. },
  85. computed:{
  86. ...mapState([
  87. 'hasLogin',
  88. 'userInfo',
  89. 'successlogion'
  90. ]),
  91. },
  92. onLoad(a) {
  93. if(this.successlogion && this.hasLogin) {
  94. this.refund(); // 获取订单
  95. }else {
  96. uni.navigateTo({
  97. url: '/pages/myCenter/logion'
  98. })
  99. }
  100. },
  101. watch:{
  102. 'successlogion':function(val) {
  103. if(val) {
  104. this.refund();
  105. }else {
  106. uni.navigateTo({
  107. url: '/pages/myCenter/logion'
  108. })
  109. }
  110. },
  111. 'hasLogin':function(val) {
  112. if(val) {
  113. this.refund();
  114. }else {
  115. uni.navigateTo({
  116. url: '/pages/myCenter/logion'
  117. })
  118. }
  119. },
  120. },
  121. methods: {
  122. getop() {
  123. this.scrollTop = this.old.scrollTop
  124. this.$nextTick(function(){
  125. this.scrollTop=0;
  126. });
  127. this.isTop = false;
  128. },
  129. gotologion() {
  130. uni.navigateTo({
  131. url: '/pages/myCenter/logion'
  132. })
  133. },
  134. // 关闭弹窗
  135. // cancelDiaolog() {
  136. // this.showdialog = false;
  137. // },
  138. // // 确定
  139. // confirmDiaolog() {
  140. // this.showdialog = false;
  141. // this.getlist(); // 获取订单
  142. // 订单退款售后列表
  143. refund() {
  144. this.request({
  145. url: '/v3/order/refund_list',
  146. method: 'POST',
  147. data: {
  148. state: this.state,
  149. page: this.page,
  150. page_size: 10
  151. },
  152. success: (res) => {
  153. if(res.data.data.refund_list.length< 10) {
  154. this.ispull = false;
  155. }
  156. res.data.data.refund_list.forEach((item,index) => {
  157. // item.goods.forEach(items => {
  158. let arr = item.goods_name.split(' ');
  159. item.desarray = arr[0];
  160. item.descire = item.goods_name.replace(arr[0], '');
  161. // })
  162. })
  163. this.order_list = this.order_list.concat(res.data.data.refund_list);
  164. }
  165. })
  166. },
  167. cancelDialog() {
  168. this.orderCancel = false;
  169. },
  170. goDetail(e) {
  171. let order_id = e;
  172. uni.navigateTo({
  173. url: `/pages/myOrder/returndetail?id=${order_id}`
  174. });
  175. },
  176. upper(e) {
  177. console.log(e)
  178. console.log("顶部")
  179. },
  180. // 滚到底部
  181. lower(e) {
  182. if(this.ispull) {
  183. this.page += 1;
  184. this.getlist();
  185. }
  186. },
  187. // 滚动时触发
  188. scroll(e) {
  189. if(e.detail.scrollTop > 400) {
  190. this.isTop = true;
  191. }else{ //当距离小于500时显示回到顶部按钮
  192. this.isTop = false;
  193. }
  194. this.old.scrollTop = e.detail.scrollTop
  195. }
  196. }
  197. }
  198. </script>
  199. <style>
  200. page {
  201. background-color: #F5F5F5;
  202. }
  203. .cart-list {
  204. background-color: #fff;
  205. border-top: 12upx solid #F5F5F5;
  206. }
  207. .topTip {
  208. display: flex;
  209. align-items: center;
  210. justify-content: space-between;
  211. padding: 20upx 36upx;
  212. border-bottom: 1px solid #F5F5F5;
  213. }
  214. .changewidth {
  215. color: #303133;
  216. font-size: 32upx;
  217. font-weight: 100!important;
  218. }
  219. .van-card__desc {
  220. font-size: 25rpx;
  221. color: #999!important;
  222. padding-top: 10rpx;
  223. }
  224. .priceClass {
  225. color:#303133!important;
  226. font-size: 36upx;
  227. font-weight: normal!important;
  228. }
  229. .van-card {
  230. background-color: #fff!important;
  231. }
  232. .shoplist {
  233. display: flex;
  234. justify-content: space-between;
  235. align-items: center;
  236. }
  237. .deleChange {
  238. border: 1px solid #C0C4CC;
  239. padding: 8upx;
  240. }
  241. </style>