mine_sale_list.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  1. <template>
  2. <view class="dt-page">
  3. <!-- <view class="scroll-tab-wrap">
  4. <DtScrollTab
  5. :config="configTab"
  6. :dataList="tabList"
  7. :current.sync="curTab"
  8. @change="onTabChange"/>
  9. </view> -->
  10. <!-- <swiper :style="calcHeight" duration="300"
  11. :current="curTab"
  12. @change="onSwiperChange">
  13. <swiper-item v-for="(tItem, tIdx) in tabList" :key="tIdx"> -->
  14. <!-- <scroll-view @scrolltolower="onReachLower" scroll-y="true" class="scoll-h"> -->
  15. <!-- <block v-if="curTab==tIdx"> -->
  16. <view v-if="emptyType==0" class="content-wrap">
  17. <view v-for="(item,idx) in dataList" :key="idx" class="order-item-wrap">
  18. <DtOrderItem
  19. :dataDetail="item"
  20. @timer="onTimer(idx)"
  21. @tapbtn="onTapBtn"
  22. @order="onOrderTap" />
  23. <DtNoMore v-if="isNoMore" />
  24. </view>
  25. </view>
  26. <DtEmpty :type="emptyType" />
  27. <!-- </block> -->
  28. <!-- </scroll-view>
  29. </swiper-item>
  30. </swiper> -->
  31. </view>
  32. </template>
  33. <script>
  34. import DtScrollTab from '../comps/dt_scroll_tab.vue'
  35. import DtOrderItem from '../comps/dt_order_item.vue'
  36. import DtEmpty from '../comps/dt_empty.vue'
  37. export default {
  38. components:{
  39. DtScrollTab,
  40. DtOrderItem,
  41. DtEmpty
  42. },
  43. data(){
  44. return {
  45. // configTab:{
  46. // width:'20vw',
  47. // isActiveLine:true
  48. // },
  49. // curTab:0,
  50. // tabList:['全部','待付款','待发货','待收货','已取消','已完成','退货退款'],
  51. // winHeight: "", //窗口高度,
  52. dataList:[],
  53. memberId:'',
  54. }
  55. },
  56. computed:{
  57. calcHeight () {
  58. return "height:"+this.winHeight+"px;";
  59. },
  60. tabValues(){
  61. return [
  62. this.orderState.all,
  63. this.orderState.waitForPay,
  64. this.orderState.waitForDelive,
  65. this.orderState.waitForReceive,
  66. this.orderState.cancel,
  67. this.orderState.finished,
  68. // this.orderState.
  69. ]
  70. },
  71. orderState(){
  72. return this.$global.orderState
  73. },
  74. refundState(){
  75. return [
  76. this.orderState.refunded, // 已退款
  77. this.orderState.failRefund, // 退款失败
  78. this.orderState.refunding, // 退款中
  79. ]
  80. },
  81. },
  82. methods:{
  83. // onSwiperChange(e){
  84. // console.log(113,e)
  85. // this.curTab = e.detail.current
  86. // this.isNoMore = false
  87. // this.emptyType = -1
  88. // this.pageIndex = 0;
  89. // this.dataList.length = 0
  90. // this.queryDataList(this.tabValues[this.curTab])
  91. // },
  92. // onTabChange(idx){
  93. // console.log(23,this.tabValues[idx])
  94. // },
  95. onOrderTap(item){
  96. uni.navigateTo({
  97. url:'/pagesM/pages/order_detail?orderSns='+item.sn
  98. })
  99. },
  100. // 过期
  101. onTimer(idx){
  102. let dataList = this.dataList.slice(0)
  103. let curItem = dataList[idx]
  104. let state = this.orderState.cancel
  105. curItem.status = state
  106. curItem.statusTxt = this.$global.orderStateName[state]
  107. dataList[idx] = curItem
  108. this.dataList = dataList
  109. },
  110. onTapBtn(flag,item){
  111. console.log(118,flag,item)
  112. switch(flag){
  113. case 'cancel':
  114. this.$dialog.confirm({
  115. content:'确认取消该订单吗?',
  116. success: async (res) => {
  117. if (res.confirm) {
  118. this.cancelOrder(item)
  119. }
  120. }
  121. })
  122. break;
  123. case 'pay':
  124. this.payOrder(item)
  125. break;
  126. case 'refund':
  127. this.refund(item)
  128. break;
  129. case 'cancelRefund':
  130. this.cancelRefund(item)
  131. break;
  132. case 'receive':
  133. this.receive(item)
  134. break;
  135. case 'appraise':
  136. uni.navigateTo({
  137. url:'/pagesM/pages/order_appraise?orderId='+item.orderId
  138. })
  139. break;
  140. case 'delete':
  141. this.$dialog.confirm({
  142. content:'确认删除该订单吗?',
  143. success: async (res) => {
  144. if (res.confirm) {
  145. this.delOrder(item)
  146. }
  147. }
  148. })
  149. break;
  150. default:break;
  151. }
  152. },
  153. async cancelOrder(item){
  154. let resp = await this.$api.cancelOrder({
  155. sn:item.sn,
  156. detail:'订单取消',
  157. remark:'B2C微信小程序用户取消订单',
  158. })
  159. this.$util.refreshPage(['pages/mine'])
  160. this.isPull = true
  161. this.queryDataList()
  162. },
  163. async payOrder(item){
  164. let sns = [item.sn]
  165. uni.navigateTo({ url: "/pagesM/pages/order_pay?orderSns=" + JSON.stringify(sns)+"&payFlag="+this.$global.payFlag.order});
  166. },
  167. async refund(item){
  168. },
  169. async cancelRefund(item){
  170. // let resp = await this.$api.
  171. },
  172. async receiveOrder(item){
  173. let resp = await this.$api.orderChange({
  174. memberId:this.memberId,
  175. orderId:item.id,
  176. execType:2
  177. })
  178. this.$dialog.success('确认收货')
  179. },
  180. async delOrder(item){
  181. let resp = await this.$api.delOrder({
  182. orderId:item.id
  183. })
  184. // this.$dialog.success('删除成功')
  185. this.$util.refreshPage(['pages/mine'])
  186. this.isPull = true
  187. this.queryDataList()
  188. },
  189. onReachLower(ev){
  190. this.onReachBottomPage()
  191. },
  192. // 查询数据
  193. async queryDataList(){
  194. if(this.isPull){
  195. this.emptyType = -1
  196. this.isNoMore = false
  197. this.pageIndex = 0
  198. this.dataList.length = 0
  199. }
  200. let resp = await this.$api.getAftersaless({
  201. _isShowLoading:true,
  202. memberId:this.memberId,
  203. pageNo:this.pageIndex,
  204. pageSize:this.pageSize
  205. })
  206. let list = this.getDataList(resp)
  207. list.map((item)=>{
  208. item.aftersalesItems.map((itm)=>{
  209. itm.specificationsDesc = itm.specifications.join('+')
  210. return itm
  211. })
  212. return item
  213. })
  214. this.dataList = this.dataList.concat(list)
  215. },
  216. onLoadPage(options){
  217. wx.hideShareMenu();
  218. if(this.isLoad){
  219. this.memberId = this.$auth.getMemberId()
  220. // 初始化高度
  221. // let res = uni.getSystemInfoSync();
  222. // let clientHeight = res.windowHeight;
  223. // let clientWidth = res.windowWidth;
  224. // let upxR = 750/clientWidth;
  225. // let calc = clientHeight*upxR-110;
  226. // let height = uni.upx2px(calc);
  227. // this.winHeight=height;
  228. }
  229. this.queryDataList()
  230. },
  231. }
  232. }
  233. </script>
  234. <style lang="scss" scoped>
  235. .dt-page{
  236. min-height:100vh;
  237. background-color:#f2f2f2;
  238. .scroll-tab-wrap{
  239. margin-bottom:20upx;
  240. }
  241. .scoll-h {
  242. height: 100%;
  243. // .conttent-wrap {
  244. // }
  245. }
  246. .content-wrap{
  247. .order-item-wrap{
  248. margin-bottom:20upx;
  249. }
  250. }
  251. }
  252. </style>