| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260 |
- <template>
- <view class="dt-page">
- <!-- <view class="scroll-tab-wrap">
- <DtScrollTab
- :config="configTab"
- :dataList="tabList"
- :current.sync="curTab"
- @change="onTabChange"/>
- </view> -->
- <!-- <swiper :style="calcHeight" duration="300"
- :current="curTab"
- @change="onSwiperChange">
- <swiper-item v-for="(tItem, tIdx) in tabList" :key="tIdx"> -->
- <!-- <scroll-view @scrolltolower="onReachLower" scroll-y="true" class="scoll-h"> -->
- <!-- <block v-if="curTab==tIdx"> -->
- <view v-if="emptyType==0" class="content-wrap">
- <view v-for="(item,idx) in dataList" :key="idx" class="order-item-wrap">
- <DtOrderItem
- :dataDetail="item"
- @timer="onTimer(idx)"
- @tapbtn="onTapBtn"
- @order="onOrderTap" />
- <DtNoMore v-if="isNoMore" />
- </view>
- </view>
- <DtEmpty :type="emptyType" />
- <!-- </block> -->
- <!-- </scroll-view>
- </swiper-item>
- </swiper> -->
- </view>
- </template>
- <script>
- import DtScrollTab from '../comps/dt_scroll_tab.vue'
- import DtOrderItem from '../comps/dt_order_item.vue'
- import DtEmpty from '../comps/dt_empty.vue'
- export default {
- components:{
- DtScrollTab,
- DtOrderItem,
- DtEmpty
- },
- data(){
- return {
- // configTab:{
- // width:'20vw',
- // isActiveLine:true
- // },
- // curTab:0,
- // tabList:['全部','待付款','待发货','待收货','已取消','已完成','退货退款'],
- // winHeight: "", //窗口高度,
- dataList:[],
- memberId:'',
- }
- },
- computed:{
- calcHeight () {
- return "height:"+this.winHeight+"px;";
- },
- tabValues(){
- return [
- this.orderState.all,
- this.orderState.waitForPay,
- this.orderState.waitForDelive,
- this.orderState.waitForReceive,
- this.orderState.cancel,
- this.orderState.finished,
- // this.orderState.
- ]
- },
- orderState(){
- return this.$global.orderState
- },
- refundState(){
- return [
- this.orderState.refunded, // 已退款
- this.orderState.failRefund, // 退款失败
- this.orderState.refunding, // 退款中
- ]
- },
- },
- methods:{
-
- // onSwiperChange(e){
- // console.log(113,e)
- // this.curTab = e.detail.current
- // this.isNoMore = false
- // this.emptyType = -1
- // this.pageIndex = 0;
- // this.dataList.length = 0
- // this.queryDataList(this.tabValues[this.curTab])
- // },
- // onTabChange(idx){
- // console.log(23,this.tabValues[idx])
- // },
- onOrderTap(item){
- uni.navigateTo({
- url:'/pagesM/pages/order_detail?orderSns='+item.sn
- })
- },
- // 过期
- onTimer(idx){
- let dataList = this.dataList.slice(0)
- let curItem = dataList[idx]
- let state = this.orderState.cancel
- curItem.status = state
- curItem.statusTxt = this.$global.orderStateName[state]
- dataList[idx] = curItem
- this.dataList = dataList
- },
- onTapBtn(flag,item){
- console.log(118,flag,item)
- switch(flag){
- case 'cancel':
- this.$dialog.confirm({
- content:'确认取消该订单吗?',
- success: async (res) => {
- if (res.confirm) {
- this.cancelOrder(item)
- }
- }
- })
-
- break;
- case 'pay':
- this.payOrder(item)
- break;
- case 'refund':
- this.refund(item)
- break;
- case 'cancelRefund':
- this.cancelRefund(item)
- break;
- case 'receive':
- this.receive(item)
- break;
- case 'appraise':
- uni.navigateTo({
- url:'/pagesM/pages/order_appraise?orderId='+item.orderId
- })
- break;
- case 'delete':
- this.$dialog.confirm({
- content:'确认删除该订单吗?',
- success: async (res) => {
- if (res.confirm) {
- this.delOrder(item)
- }
- }
- })
- break;
- default:break;
- }
- },
- async cancelOrder(item){
- let resp = await this.$api.cancelOrder({
- sn:item.sn,
- detail:'订单取消',
- remark:'B2C微信小程序用户取消订单',
- })
- this.$util.refreshPage(['pages/mine'])
- this.isPull = true
- this.queryDataList()
- },
- async payOrder(item){
- let sns = [item.sn]
- uni.navigateTo({ url: "/pagesM/pages/order_pay?orderSns=" + JSON.stringify(sns)+"&payFlag="+this.$global.payFlag.order});
- },
- async refund(item){
-
- },
- async cancelRefund(item){
- // let resp = await this.$api.
- },
- async receiveOrder(item){
- let resp = await this.$api.orderChange({
- memberId:this.memberId,
- orderId:item.id,
- execType:2
- })
- this.$dialog.success('确认收货')
- },
- async delOrder(item){
- let resp = await this.$api.delOrder({
- orderId:item.id
- })
- // this.$dialog.success('删除成功')
- this.$util.refreshPage(['pages/mine'])
- this.isPull = true
- this.queryDataList()
- },
- onReachLower(ev){
- this.onReachBottomPage()
- },
- // 查询数据
- async queryDataList(){
- if(this.isPull){
- this.emptyType = -1
- this.isNoMore = false
- this.pageIndex = 0
- this.dataList.length = 0
- }
- let resp = await this.$api.getAftersaless({
- _isShowLoading:true,
- memberId:this.memberId,
- pageNo:this.pageIndex,
- pageSize:this.pageSize
- })
- let list = this.getDataList(resp)
- list.map((item)=>{
- item.aftersalesItems.map((itm)=>{
- itm.specificationsDesc = itm.specifications.join('+')
- return itm
- })
- return item
- })
- this.dataList = this.dataList.concat(list)
- },
- onLoadPage(options){
- wx.hideShareMenu();
- if(this.isLoad){
- this.memberId = this.$auth.getMemberId()
- // 初始化高度
- // let res = uni.getSystemInfoSync();
- // let clientHeight = res.windowHeight;
- // let clientWidth = res.windowWidth;
- // let upxR = 750/clientWidth;
- // let calc = clientHeight*upxR-110;
- // let height = uni.upx2px(calc);
- // this.winHeight=height;
- }
-
- this.queryDataList()
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- .dt-page{
- min-height:100vh;
- background-color:#f2f2f2;
- .scroll-tab-wrap{
- margin-bottom:20upx;
- }
- .scoll-h {
- height: 100%;
- // .conttent-wrap {
- // }
- }
- .content-wrap{
- .order-item-wrap{
- margin-bottom:20upx;
- }
- }
- }
- </style>
|