You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

968 lines
34 KiB

<template>
<view class="page1">
<view v-if="enDayShow" @tap="bigFWHPic" style="width:100%;height:60rpx;">
<u-notice-bar mode='horizontal' bgColor="#088FEB" color="#eee" :text="textArr"></u-notice-bar>
</view>
<uni-section class="mb-10" title="历史订单" type="line">
<view class="example-body">
<uni-datetime-picker border='false' v-model="range" type="daterange" @change="sectionChange" />
</view>
<view style="display: flex;">
<view class="shop-choose" :style="{'width':userList.length > 1?'70%':'100%'}">
<view class="shop-name">
店铺
</view>
<uni-data-select style="width: 100%" v-model="shopId" :localdata="shopList" :clear='false' @change="change"></uni-data-select>
</view>
<view v-if="userList.length > 1" @tap="$refs.userPopup.open()" style="width: 25%;margin-left: 2.5%;background: #007AFF;height: 80rpx;text-align: center;color: #fff;border-radius: 10px;line-height: 80rpx;margin-top: 20rpx;font-size: 24rpx;">
切换身份
</view>
</view>
</uni-section>
<view style="background: #fff;border: 1px solid #eee;">
<uni-segmented-control :current="current" :values="items" @clickItem="onClickItem" styleType="text"
activeColor="#007aff"></uni-segmented-control>
</view>
<view class="content">
<view v-show="current === 0">
<view class="ulList" v-if="list.length > 0">
<ul>
<li v-for="(item,index ) in list" :key="index" @tap="goDetail(item)">
<uni-card :title="item.userName == null ?'暂无':item.userName" :sub-title="item.createTime == null ?'暂无':item.createTime" :extra="'数量:'+(item.productCount == null ?'暂无':item.productCount)">
<view class="uni-body" style="font-weight: bold;font-size: 30rpx;">
<text class="cardText" style="font-size: 30rpx;">单号</text>
{{item.id}}
</view>
<view class="uni-body"><text class="cardText">销售员</text> {{item.createByName == null ?'暂无':item.createByName}}</view>
<view class="uni-body">
<text class="cardText">销售金额</text>
<text class="priceText">{{item.totalAmount == null ?'暂无':item.totalAmount}}</text>
<text decode class="cardText">{{'&nbsp;&nbsp;&nbsp;&nbsp; 欠款: '}}</text>
<text class="priceText" style="color:red;">{{item.noEarn == null ?'暂无':item.noEarn}}</text>
</view>
<view class="uni-body" v-if="item.returnSaleProductCount > 0">
<text class="cardText">退货金额</text>
<text class="priceText">{{item.returnSaleTotalAmount == null ?'暂无':item.returnSaleTotalAmount}}</text>
<text decode class="cardText">{{'&nbsp;&nbsp;&nbsp;&nbsp; 退货数: '}}</text>
<text class="priceText">{{item.returnSaleProductCount == null ?'暂无':item.returnSaleProductCount}}</text>
</view>
<view class="uni-body"> <text class="cardText">
订单状态</text>{{item.status == '0' ?'待抢单' :item.status == '2' ?'作废' :item.status == '1' ?'待取货' :item.status == '3' ?'待送达' :item.status == '4' ?'已完成' :item.status == '5' ?'下游客户待退货' :item.status == '00' ?'退货待抢单' :item.status == '01' ?'退货待取货' :item.status == '03' ?'退货待送达' :item.status == '04' ?'待确认退货' :item.status == '6' ?'待配货':item.status == '8' ?'待物流上门':item.status == '9' ?'已完成' :'挂单'}}
</view>
</uni-card>
</li>
</ul>
</view>
</view>
<view v-show="current === 1">
<view style="background: #fff;color:#eee;">
<view ref="top" style="height: 120rpx;">
<view style="text-align: center;display: flex;border-top: 1px solid #eee;padding: 20rpx 0;color: #7E5E60;font-weight: bold;">
<view style="display: flex;flex-direction: column;width: 20%;">
<text>{{duizhangList.initialArrears >= 0?'期初欠款':'期初余额'}}</text>
<text>{{duizhangList.initialArrears == null ?"0" :Math.abs(duizhangList.initialArrears)}}</text>
</view>
<view
style="display: flex;flex-direction: column;width: 20%;border-left: 1px solid #eee;">
<text>{{duizhangList.endArrears >= 0?'期末欠款':'期末余额'}}</text>
<text>{{duizhangList.endArrears == null ?"0" :Math.abs(duizhangList.endArrears)}}</text>
</view>
<view
style="display: flex;flex-direction: column;width: 20%;border-left: 1px solid #eee;">
<text>{{duizhangList.arrears >= 0?'本期欠款':'本期余额'}}</text>
<text>{{duizhangList.arrears == null ?"0" :Math.abs(duizhangList.arrears)}}</text>
</view>
<view
style="display: flex;flex-direction: column;width: 20%;border-left: 1px solid #eee;">
<text>拿货总额</text>
<text>{{duizhangList.totalSale == null ?"0" :duizhangList.totalSale}}</text>
</view>
<view
style="display: flex;flex-direction: column;width: 20%;border-left: 1px solid #eee;">
<text>退货总额</text>
<text>{{duizhangList.totalReturn == null ?"0" :duizhangList.totalReturn}}</text>
</view>
</view>
</view>
</view>
<view v-if="duizhangList" v-for="(item,index) in duizhangRecords" :key="index"
style="background: #fff;display: block;overflow: hidden;margin: 20rpx auto;width: 95%;border-radius: 10px;position: relative;">
<view style="display: flex;">
<view
style="margin-top: 40rpx;width: 120rpx;height: 120rpx;border-radius: 80rpx;background: #8470FF;color: #fff;font-size: 26rpx;padding: 24rpx 34rpx;margin: 35rpx 0 0 35rpx;">
{{item.dealingsType == 0 ?"销售开单" :item.dealingsType == 1 ?"退货" :item.dealingsType == 2 ?"回款" :item.dealingsType == 3 && item.amount< 0?"初始余额" :item.dealingsType == 3 && item.amount>= 0?"初始欠款" :item.dealingsType == 4 ?"充值金额" :item.dealingsType == 5 ?"追加欠款" :item.dealingsType == 6 ?"撤销订单" :""}}
</view>
<view style="height: 170rpx;line-height: 50rpx;padding-left: 30rpx;">
<view
style="color: #747474;font-size: 28rpx;font-weight: bold;font-size: 32rpx;color: #000;" :style="{'margin-top':item.isOldName== false?'20rpx':'34rpx'}">
{{item.createTime | removeStr}}
</view>
<view style="color: #747474;font-size: 28rpx;">
操作人:{{item.createByName == null ?"" :item.createByName}}
</view>
<view v-if="item.isOldName== false" style="color: red;font-size: 28rpx;">
客户:{{item.dealingsUserName}}
</view>
<view @tap="oneShare(item,'xiaoshou')" v-if="item.dealingsType == 0 && isDownKH == false && item.delFlag == 0 &&item.billSaleDetailVos != null" style="width: 100rpx;height: 60rpx;background: #088FEB;color: #fff;border-radius: 10px;position: absolute;top: 30rpx;right: 20rpx;text-align: center;line-height: 60rpx;">
分享
</view>
<view @tap="oneShare(item,'chongzhi')" v-if="(item.dealingsType == 4 || item.dealingsType == 5) && isDownKH == false" style="width: 100rpx;height: 60rpx;background: #088FEB;color: #fff;border-radius: 10px;position: absolute;top: 30rpx;right: 20rpx;text-align: center;line-height: 60rpx;">
分享
</view>
<img v-if="item.delFlag == 1 && item.dealingsType == 0 && item.billSaleDetailVos != null" src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/7650e962bef14f529406866888eeff24.png" alt="" style="position: absolute;top: 0;right:0;width: 300rpx;height: 150rpx;" />
<img v-if="item.delFlag == 1 && item.dealingsType == 0 && item.billSaleDetailVos == null" src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/7517e15b5cf843d59b5b69c3a06a5d7b.png" alt="" style="position: absolute;top: 0;right:0;width: 200rpx;height: 110rpx;" />
<img v-if="item.dealingsType == 6" src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/862680ecfe5a48b1a410287fb45987ef.png" alt="" style="position: absolute;top: 0;right:0;width: 300rpx;height: 150rpx;" />
</view>
</view>
<view v-if="item.billSaleDetailVos != null || item.billReturnSaleDetailVos != null"
style="height: 60rpx;line-height: 60rpx;padding-left: 20rpx;font-size: 28rpx;background: #FFF0F5;color: #F08080;margin-bottom: 20rpx;width: 95%;margin: 0 auto 20rpx;border-radius: 5px;">
拿货数据~请查收
</view>
<view v-if="item.billSaleDetailVos != null"
style="width: 95%;margin: 0 auto;border: 1.5px solid #000;border-radius: 10px;">
<uni-table stripe>
<uni-tr style="background: #FFBF00;">
<uni-th align="center" width="120">
<text style="font-weight: bold;">
</text>
货号
</uni-th>
<uni-th align="center" width="55">数量</uni-th>
<uni-th align="center" width="70">销售价</uni-th>
<uni-th align="center" width="80">总价</uni-th>
</uni-tr>
<!-- 表格数据行 -->
<uni-tr v-for="(item1,index1) in item.billSaleDetailVos" :key="index1"
@tap="clickDetail(item1)">
<uni-td align="center">
<text>
{{item1.productSn == null ?"" :item1.productSn}}
</text>
</uni-td>
<uni-td
align="center">{{item1.productCount == null ?"0" :item1.productCount}}</uni-td>
<uni-td
align="center">{{item1.discountAmount == null ?"0" :item1.discountAmount}}</uni-td>
<uni-td
align="center">{{item1.totalAmount == null ?"0" :item1.totalAmount}}</uni-td>
</uni-tr>
</uni-table>
</view>
<view v-if="item.billReturnSaleDetailVos != null"
style="width: 95%;margin: 20rpx auto 0;border: 1.5px solid #000;border-radius: 10px;">
<uni-table stripe>
<uni-tr style="background: #FFBF00;">
<uni-th align="center" width="120">
<text style="font-weight: bold;color:#F08080;">
退
</text>
货号
</uni-th>
<!-- <uni-th align="center">规格</uni-th> -->
<uni-th align="center" width="55">数量</uni-th>
<uni-th align="center" width="70">退货价</uni-th>
<uni-th align="center" width="80">总价</uni-th>
</uni-tr>
<!-- 表格数据行 -->
<uni-tr v-for="(item1,index1) in item.billReturnSaleDetailVos" :key="index1"
@tap="clickDetail(item1)">
<uni-td align="center">
<text>
{{item1.productSn == null ?"" :item1.productSn}}
</text>
</uni-td>
<uni-td
align="center">{{item1.productCount == null ?"0" :item1.productCount}}</uni-td>
<uni-td
align="center">{{item1.discountAmount == null ?"0" :item1.discountAmount}}</uni-td>
<uni-td
align="center">{{item1.totalAmount == null ?"0" :item1.totalAmount}}</uni-td>
</uni-tr>
</uni-table>
</view>
<view style="border-bottom: 2px solid #eee;" v-if="item.billSaleDetailVos != null">
<view style="font-weight: bold;padding: 20rpx;">
付款明细:
</view>
<view>
<view>
<view style="padding-left: 20rpx;">
<text>销售金额:{{item.totalAmount == null ?"0" :item.totalAmount}}</text>
</view>
<view style="padding-left: 20rpx;">
<text>退货金额:{{item.returnSaleTotalAmount == null ?"0" :item.returnSaleTotalAmount}}</text>
</view>
</view>
<view style="padding-left: 20rpx;margin-top: 40rpx;">
<view>欠款抵退货:{{item.debtDeductionAmount == null ?"0" :item.debtDeductionAmount}}
</view>
<view>销售抵退货:{{item.saleDeductionAmount == null ?"0" :item.saleDeductionAmount}}
</view>
<view>
余额抵销售:{{item.balanceDeductionAmount == null ?"0" :item.balanceDeductionAmount}}
</view>
</view>
<view v-if="item.remark != '' && item.remark !=undefined && item.remark != null" style="padding-left: 20rpx;margin-top: 40rpx;">
<view>备注:{{item.remark}}</view>
</view>
</view>
<view
style="padding-left: 20rpx;margin: 40rpx 0 20rpx;height: 60rpx;line-height: 60rpx;text-align: center;font-size: 30rpx;font-weight: bold;display: flex;">
<text style="flex: 1;">本单应收:{{item.realAmount == null ?"0" :item.realAmount}}</text>
<text
style="display: inline-block;padding-left: 20rpx;flex: 1;">本单实收:{{item.alreadyEarn == null ?"0" :item.alreadyEarn}}</text>
</view>
</view>
<view style="text-align: center;display: flex;padding: 20rpx 0;color: #000;">
<view v-if="item.lastDebtAmount >= 0" style="flex: 1;display: flex;flex-direction: column;">
<text>之前欠款</text>
<text>{{item.lastDebtAmount == null ?"0" :item.lastDebtAmount}}</text>
</view>
<view v-if="item.lastDebtAmount < 0" style="flex: 1;display: flex;flex-direction: column;">
<text>之前余额</text>
<text>{{item.lastDebtAmount == null ?"0" :Math.abs(item.lastDebtAmount)}}</text>
</view>
<view v-if="item.dealingsType == 5 || item.amount >= 0"
style="flex: 1;border-left: 1px solid #eee;display: flex;flex-direction: column;">
<text>{{item.dealingsType == 5?'追加欠款':item.dealingsType == 4?'充值金额':item.dealingsType == 6?'撤销余额':item.dealingsType == 10?'本单退款':'本单欠款'}}</text>
<text>{{item.amount == null ?"0" :item.dealingsType == 5?Math.abs(item.amount):item.amount}}</text>
</view>
<view v-if="item.amount < 0 && item.dealingsType != 5"
style="flex: 1;border-left: 1px solid #eee;display: flex;flex-direction: column;">
<text>{{item.dealingsType == 4?'充值金额':item.dealingsType == 6?'撤销欠款':'本单余额'}}</text>
<text>{{item.amount == null ?"0" :Math.abs(item.amount)}}</text>
</view>
<view v-if="item.balanceDue >= 0"
style="flex: 1;border-left: 1px solid #eee;display: flex;flex-direction: column;">
<text>{{item.dealingsType == 6?'撤销后欠款':'本单后欠款'}}</text>
<text>{{item.balanceDue == null ?"0" :item.balanceDue}}</text>
</view>
<view v-if="item.balanceDue < 0"
style="flex: 1;border-left: 1px solid #eee;display: flex;flex-direction: column;">
<text>{{item.dealingsType == 6?'撤销后余额':'本单后余额'}}</text>
<text>{{item.balanceDue == null ?"0" :Math.abs(item.balanceDue)}}</text>
</view>
</view>
</view>
<view style="text-align: center;margin-bottom:20rpx;">
<text>对账时间:{{duizhangList.queryDate == null ?"" :duizhangList.queryDate}}</text>
</view>
</view>
<view v-show="current === 2">
<view class="shop-box" v-for="(item,index4) in list" :key="index4"
style="background: #fff;display: block;overflow: hidden;margin: 0 auto 20rpx;">
<view>
<view
style="padding-left: 20rpx;margin: 40rpx 0; font-weight: bold;font-size: 36rpx;text-align: center;">
<text>货号:{{item.productSn == null?'':item.productSn}}</text>
</view>
<view style="text-align: center;margin-bottom:20rpx;">
<text>名称:{{item.productName == null?'':item.productName}}</text>
<text
style="padding: 0 20rpx;">总数量:{{item.productCount == undefined ?'0':item.productCount}}</text>
</view>
<uni-table border stripe emptyText="暂无更多数据">
<!-- 表头行 -->
<uni-tr style="background: #eee;">
<uni-th align="center" width="100">日期</uni-th>
<uni-th align="center" width="50">数量</uni-th>
<uni-th align="center" width="70">单价</uni-th>
<uni-th align="center" width="70">总价</uni-th>
</uni-tr>
<!-- 表格数据行 -->
<uni-tr v-for="(item1,index1) in item.customerBuySaleVoList" :key="index1"
@tap="xiaoshouDetail('2',item1)">
<uni-td align="center">{{item1.createTime | removeStr}}</uni-td>
<uni-td align="center">{{item1.productCount}}</uni-td>
<uni-td
align="center">{{item1.customerBuyProductDetailLogVos[0].realPrice}}</uni-td>
<uni-td
align="center">{{item1.customerBuyProductDetailLogVos[0].realPrice * item1.productCount}}</uni-td>
</uni-tr>
</uni-table>
</view>
</view>
</view>
<view v-show="current === 3">
<view v-for="(item,index) in list" :key="index"
style="background: #fff;display: block;overflow: hidden;margin: 0 auto 20rpx;">
<view style="width: 100%;height: 80rpx;line-height: 80rpx;">
<text
style="display:inline-block;width: 55%;text-align: center;font-weight: bold;font-size: 30rpx;">
日期:{{item.createTime | removeStr}}
</text>
<text
style="display:inline-block;width: 45%;text-align: center;border-left: 1px solid #eee;">
操作:{{item.createByName == null?'':item.createByName}}
</text>
</view>
<uni-table border stripe emptyText="暂无更多数据">
<!-- 表头行 -->
<uni-tr style="background: #eee;">
<uni-th align="center" width="85">货号</uni-th>
<uni-th align="center" width="50">数量</uni-th>
<uni-th align="center" width="70">退货价</uni-th>
</uni-tr>
<!-- 表格数据行 -->
<uni-tr v-for="(items,index1) in item.returnSaleDetailList" :key="index1"
@tap="xiaoshouDetail('3',items)">
<uni-td align="center">{{items.productSn == null ? '': items.productSn}}</uni-td>
<uni-td align="center">{{items.productCount}}</uni-td>
<uni-td align="center">{{items.discountAmount}}</uni-td>
</uni-tr>
</uni-table>
</view>
</view>
</view>
<u-loadmore :status="status" />
<!-- 弹出商品规格 -->
<uni-popup ref="detailPopup" background-color="#fff">
<view style="width: 500rpx;min-height: 500rpx;max-height: 1000rpx;overflow: scroll;">
<view @tap="$refs.detailPopup.close()"
style='width: 50rpx;height: 50rpx;position: absolute;right: 20rpx;top: 25rpx;'>
<uni-icons type="closeempty" color="red" size="22"></uni-icons>
</view>
<view style="height: 100rpx;line-height: 100rpx;font-weight: bold;font-size: 36rpx;text-align: center;">
{{detailList.productName}}({{detailList.productSn}})
</view>
<uni-table border stripe emptyText="暂无更多数据" style="margin-bottom: 20rpx;">
<!-- 表头行 -->
<uni-tr style="background: #eee;">
<uni-th align="center" width="80">规格</uni-th>
<uni-th align="center" width="55">数量</uni-th>
</uni-tr>
<!-- 表格数据行 -->
<uni-tr v-for="(item,index) in detailList.billAttributeListVos" :key="index">
<uni-td align="center">{{item.attributeList | sliceMsg}}</uni-td>
<uni-td align="center">{{item.productCount}}</uni-td>
</uni-tr>
</uni-table>
</view>
</uni-popup>
<!-- 弹出销售商品规格 -->
<uni-popup ref="xsdetailPopup" background-color="#fff">
<view style="width: 500rpx;min-height: 500rpx;max-height: 1000rpx;overflow: scroll;">
<view @tap="$refs.xsdetailPopup.close()"
style='width: 50rpx;height: 50rpx;position: absolute;right: 20rpx;top: 25rpx;'>
<uni-icons type="closeempty" color="red" size="22"></uni-icons>
</view>
<view style="height: 100rpx;line-height: 100rpx;font-weight: bold;font-size: 36rpx;text-align: center;">
规格数量详情
</view>
<uni-table border stripe emptyText="暂无更多数据" style="margin-bottom: 20rpx;border-radius: 10px;">
<!-- 表头行 -->
<uni-tr style="background: #eee;">
<uni-th align="center" width="80">规格</uni-th>
<uni-th align="center" width="55">数量</uni-th>
</uni-tr>
<!-- 表格数据行 -->
<uni-tr v-for="(item,index) in GDList" :key="index">
<uni-td align="center">{{item.attributeList | sliceMsg}}</uni-td>
<uni-td align="center">{{item.productCount}}</uni-td>
</uni-tr>
</uni-table>
</view>
</uni-popup>
<!-- 弹出用户身份选择 -->
<uni-popup ref="userPopup" background-color="#fff">
<view class="popup-content">
<view @tap="$refs.userPopup.close()"
style='width: 50rpx;height: 50rpx;position: absolute;right: 20rpx;top: 25rpx;'>
<uni-icons type="closeempty" color="red" size="22"></uni-icons>
</view>
<view style="height: 100rpx;line-height: 100rpx;font-weight: bold;font-size: 36rpx;text-align: center;">
请选择身份
</view>
<view @tap="checkUser(item.id)" v-for="(item,index) in userList" :key="index" style="line-height: 60rpx;border-top: 1px solid #eee;padding: 10rpx 20rpx;">
<view>名称:{{item.name}}</view>
<view>电话:{{item.phone}}</view>
<view>地址:{{item.address}}</view>
</view>
</view>
</uni-popup>
<uni-fab ref="fab" :content="content" :horizontal="horizontal"
@trigger="trigger" />
</view>
</template>
<script>
import {
mapState
} from 'vuex';
import {
wxLogin
} from '@/utils/global.js'
export default {
computed: mapState(['userId', 'mobile']),
data() {
return {
enDayShow:false,
textArr:['您还未关注快衣店服务号,暂无法接收充值及上新提醒,点击关注'],
range: [],
name: '',
GDList: [],
FWHPic:'https://jewel-shop.oss-cn-beijing.aliyuncs.com/f2ba2080aaa54c618c2e47df4f220087.png',
list: [],
detailList: {},
shopList: [],
userList:[],
pages:1,
duizhangRecords: [],
customerId:'',
current: '',
items: ['拿货(按订单)', '对账单', '拿货(按商品)', '退货明细'],
userId: '',
pageNum: 1,
duizhangList:[],
shopId: '',
bList: [],
query: {
startDate: '',
endDate: ''
},
horizontal: 'right',
content: [{
iconPath: '/static/images/tabbar/home.png',
selectedIconPath: '/static/images/tabbar/home-sel.png',
text: '我的',
active: false
},{
iconPath: '/static/images/tabbar/home.png',
selectedIconPath: '/static/images/tabbar/home-sel.png',
text: '退出登录',
active: false
}],
}
},
filters: {
sliceMsg(val) {
var name = ''
if (typeof(val) == 'string') {
let newObj = JSON.parse(val)
for (let as in newObj) {
name += newObj[as] + '/'
}
}
return name;
},
removeStr(val) {
if (val == null) {
return "";
} else {
var dotIndex = val.indexOf('.');
if (dotIndex !== -1) {
return val.substring(0, dotIndex);
}
return val;
}
}
},
created() {
uni.hideHomeButton() //左上角HOME按钮
},
onReachBottom() {
if (this.pageNum >= this.pages) return;
this.status = 'loading';
this.pageNum++;
if (this.current == 1) {
this.duizhangdan()
} else {
this.getList();
}
},
onShow(){
if(!uni.getStorageSync('officialAccountOpenid')){
this.getUserInfo()
}
if(this.range ==''){
this.getMonth();
}
},
onLoad(option){
if(option.q){
uni.setStorageSync('codePage',true)
}
if(option.saleId !='' && option.userId == uni.getStorageSync('userId')){
this.kehuList(option.saleId)
}
/* if(uni.getStorageSync('mini_program_openid')){
this.getToken()
} */
this.getShopList()
},
methods: {
getUserInfo(){
this.tui.request("/user/getUserInfo", "post", {
miniProgramOpenid:uni.getStorageSync('miniProgramOpenid')
}, false, true).then((res) => {
if (res.code == 200) {
if(res.result.officialAccountOpenid == null){
this.enDayShow = true
}else{
uni.setStorageSync('officialAccountOpenid',res.result.officialAccountOpenid)
}
}
}).catch((res) => {})
},
//获取code
getToken() {
uni.login({
provider: 'weixin',
success(res) {
this.getOpenId(res.code)
}
});
},
//获取小程序openid
getOpenId(code) {
this.tui.request("", "post", {
appid: 'wx6d7d4fb58d1502db',
secret: '3a2c8cd00926764bbd12fd7361e01f1d',
js_code: code,
grant_type: "authorization_code",
customId: ''
}, false, false).then((res) => {
this.status = 'nomore';
if (res.code == 200) {
} else {
this.tui.toast(res.message)
}
}).catch((res) => {})
},
bigFWHPic(){
uni.previewImage({
urls: [this.FWHPic]
})
},
//去详情页
goDetail(item){
uni.navigateTo({
url: '/package1/index/orderDetail?id=' + item.id +'&userId='+item.userId +'&shopId=' + item.shopId
})
},
//获取当月1日到当前时间
getMonth() {
let date = new Date()
let year = date.getFullYear().toString() //'年'
let month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1).toString() : (date.getMonth() + 1)
.toString() //'月'
let da = date.getDate() < 10 ? '0' + date.getDate().toString() : date.getDate().toString() //'日'
let end = year + '-' + month + '-' + da //当天
let beg = "2024-01-01" //当月第一天
this.range = [beg, end]
},
sectionChange() {
if (this.current == 1) {
this.duizhangList = []
this.pageNum = 1
this.pages = 1
this.duizhangdan()
}else{
this.list = []
this.pageNum = 1
this.pages = 1
this.getList()
}
},
clickDetail(item) {
this.detailList = item
this.$refs.detailPopup.open()
},
getShopList() {
this.tui.request('/app/shop/getAllShopByCustomer', 'get', {}, false, true, false).then(res => {
if (res.code !== 200) return
this.shopId = res.result[0].id
this.change()
this.shopList = res.result.map((v) => {
return {
text: v.shopName,
value: v.id
}
})
})
},
xiaoshouDetail(type, item) {
if (item) {
if (type == '1') {
this.GDList = item.stockLogList1
this.$refs.xsdetailPopup.open()
} else if (type == '2') {
this.GDList = item.customerBuyProductDetailLogVos
this.$refs.xsdetailPopup.open()
} else if (type == '3') {
this.GDList = item.stockLogList1
this.$refs.xsdetailPopup.open()
}
}
},
//tab切换
onClickItem(e) {
if (this.current !== e.currentIndex) {
this.current = e.currentIndex
}
this.customerIdIsExist()
},
getList(id) {
this.status = 'loading';
var url, data
if(this.current == ''){
this.current = 0
}
if (this.current == 0) {
url = "/app/sale/listPages"
data = {
userId: this.customerId,
pageVo: {
pageSize: 10,
pageNumber: this.pageNum
},
searchStr: "",
startTime: this.range[0],
endTime: this.range[1],
shopId: this.shopId,
fromWhere: 1
}
} else if (this.current == 2) {
url = "/app/sale/getCustomerBuyProductLog"
data = {
userId: this.customerId,
pageSize: 10,
startDate: this.range[0],
endDate: this.range[1],
pageNum: this.pageNum,
shopId: this.shopId
}
} else if (this.current == 3) {
url = "/app/return/getReturnSaleListByUserId"
data = {
userId: this.customerId,
startDate: this.range[0],
endDate: this.range[1],
pageNum: this.pageNum,
pageSize: "10",
shopId: this.shopId
}
}
this.tui.request(url, "post", data, false, false).then((res) => {
this.status = 'nomore';
if (res.code == 200) {
if (this.pages == 1) {
this.list = res.result.records
} else {
this.list = [...this.list, ...res.result.records]
}
this.pages = res.result.pages
if (this.current == 0) {
for (let i = 0; i < this.list.length; i++) {
this.list[i].productCount = 0
for (let j = 0; j < this.list[i].saleDetailDTOList.length; j++) {
this.list[i].saleDetailDTOList[j].productCount = 0
for (let m = 0; m < this.list[i].saleDetailDTOList[j].stockLogList1
.length; m++) {
this.list[i].productCount += this.list[i]
.saleDetailDTOList[j].stockLogList1[m].productCount
this.list[i].saleDetailDTOList[j].productCount += this.list[i]
.saleDetailDTOList[j].stockLogList1[m].productCount
}
}
}
} else if (this.current == 2) {
for (let i = 0; i < this.list.length; i++) {
this.list[i].productCount = 0
for (let j = 0; j < this.list[i].customerBuySaleVoList.length; j++) {
this.list[i].customerBuySaleVoList[j].productCount = 0
for (let m = 0; m < this.list[i].customerBuySaleVoList[j]
.customerBuyProductDetailLogVos.length; m++) {
this.list[i].productCount += this.list[i].customerBuySaleVoList[j]
.customerBuyProductDetailLogVos[m].productCount
this.list[i].customerBuySaleVoList[j].productCount += this.list[i]
.customerBuySaleVoList[j].customerBuyProductDetailLogVos[m]
.productCount
}
}
}
} else if (this.current == 3) {
for (let i = 0; i < this.list.length; i++) {
for (let j = 0; j < this.list[i].returnSaleDetailList.length; j++) {
this.list[i].returnSaleDetailList[j].productCount = 0
for (let m = 0; m < this.list[i].returnSaleDetailList[j]
.stockLogList1.length; m++) {
this.list[i].returnSaleDetailList[j].productCount += this.list[i]
.returnSaleDetailList[j].stockLogList1[m]
.productCount
}
}
}
}
} else {
this.tui.toast(res.message)
}
}).catch((res) => {})
this.$forceUpdate()
},
duizhangdan() {
this.tui.request("/app/bill/getCustomerBill", "post", {
customerId: this.customerId,
pageNum: this.pageNum,
pageSize: '10',
startDate: this.range[0],
endDate: this.range[1],
shopId: this.shopId
}, false, false).then((res) => {
if (res.code == 200) {
this.status = 'nomore';
if (this.pages == 1) {
this.duizhangList = res.result
this.duizhangRecords = res.result.customerBillSaleVos.records
} else {
for (let i = 0; i < res.result.customerBillSaleVos.records.length; i++) {
this.duizhangRecords.push(res.result.customerBillSaleVos.records[i])
}
}
this.pages = res.result.customerBillSaleVos.pages
} else {
if(res.message == '客户id不能为空'){
this.tui.toast('请选择店铺后再操作!')
}else{
this.tui.toast(res.message)
}
}
}).catch((res) => {})
},
trigger(e) {
let that = this;
if(e.index == 0){ //我的
uni.navigateTo({
url: `/package2/index/shopInfo`
})
}else{ //退出登录
uni.showModal({
title: "提示",
content: "确定退出登录吗?",
success: function(res) {
if (res.confirm) {
that.tui.request("/oauth2/logout", "POST", {}, false, false).then((res) => {
if (res.code == 200) {
that.tui.toast("退出登录成功")
uni.clearStorage();
uni.navigateTo({
url: '/package2/login/login'
})
} else {
that.tui.toast(res.message)
}
})
}
}
})
}
},
kehuList(id,shopId){
uni.navigateTo({
url: '/package1/index/orderDetail?id='+id + '&shopId='+shopId
})
},
checkUser(id){
this.customerId = id
this.$refs.userPopup.close()
if(this.current == 1){
this.duizhangdan()
}else{
this.getList()
}
},
//查看客户身份
async change(e){
let result = await this.findByUserId()
if(result == ''){
uni.showToast({
title:'暂无人员信息'
})
}else{
if(result.length > 1){
this.userList = result
this.$refs.userPopup.open()
}else{
this.customerId = result[0].id
}
}
await this.qiehuan()
},
//tab切换,请求findByUserId,跟this.customerId对比,如果有,则不用动,没有找到,有多条的话,默认选第一条,什么都没有就清空this.customerId
async customerIdIsExist(){
let that = this
let result = await this.findByUserId()
let isCustomerId = false
if(result != ''){
for(let i=0;i<result.length;i++){
if(result[i].id == this.customerId){
isCustomerId = true
}
}
if(isCustomerId == false){ //客户被店铺解绑了,清空customerId
if(result.length >= 1){
this.customerId = result[0].id
}else{
this.customerId = ''
return
}
}
}else{
this.customerId = ''
this.duizhangList = []
this.pageNum = 1
this.list = []
uni.showToast({
title:'暂无人员信息'
})
}
await this.qiehuan()
},
qiehuan(){
if (this.current == 0) {
this.list = []
this.pageNum = 1
this.getList()
} else if (this.current == 1) {
this.duizhangList = []
this.pageNum = 1
this.pages = 1
this.duizhangdan()
} else if (this.current == 2) {
this.list = []
this.pageNum = 1
this.getList()
} else if (this.current == 3) {
this.list = []
this.pageNum = 1
this.getList()
}
},
findByUserId(){
return new Promise(async (resolve, reject) => {
this.tui.request('/app/customer/findByUserId', 'post', {
userId:uni.getStorageSync('id'),
shopId:this.shopId
}, false, true).then(res => {
return resolve(res.result)
})
})
},
formatDate(date, fmt) {
var o = {
'M+': date.getMonth() + 1, //月份
'D+': date.getDate(), //日
'H+': date.getHours(), //小时
'm+': date.getMinutes(), //分
's+': date.getSeconds(), //秒
'q+': Math.floor((date.getMonth() + 3) / 3), //季度
'S': date.getMilliseconds() //毫秒
};
if (/(Y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length));
for (var k in o)
if (new RegExp('(' + k + ')').test(fmt))
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k])
.length)));
return fmt;
}
}
}
</script>
<style lang="scss" scoped>
page,.page1{
font-size: 28rpx;
}
.example-body {}
.shop-choose {
width: 70%;
padding: 25rpx 15rpx;
display: flex;
justify-content: space-between;
align-items: center;
.shop-name {
flex-basis: 150rpx;
}
}
.popup-content{
width: 500rpx;
min-height: 500rpx;
max-height: 1000rpx;
overflow: scroll;
}
@media screen and (min-width: 760px) {
.popup-content{
width: 500rpx;
min-height: 500rpx;
max-height: 800rpx;
overflow: scroll;
}
}
.ulList {
margin-top: 20rpx;
ul {
li {
font-size: 24rpx;
.floatRight {
float: right;
padding: 14rpx;
color: $u-primary;
font-size: 26rpx;
}
.cardText {
font-size: 24rpx;
}
.priceText {
color: $u-primary;
font-size: 28rpx;
}
}
}
}
.mine {
position: fixed;
bottom: 120rpx;
right: 20rpx;
width: 88rpx;
height: 88rpx;
line-height: 88rpx;
text-align: center;
border-radius: 88rpx;
color: #fff;
background-color: $u-primary;
}
.mine:active {
opacity: .8;
}
</style>