平板端快衣店
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.
 
 
 
 
 

1043 lines
36 KiB

<template>
<view>
<cmd-nav-bar iconOne="menu" @iconOne="goToInfo" :title="shopName" background-color="#fff"></cmd-nav-bar>
<view class="IndexContent">
<view v-if="enDayShow" style="width:100%;height:60rpx;">
<u-notice-bar mode='horizontal' bgColor="#088FEB" color="#eee" :text="textArr"></u-notice-bar>
</view>
<view class="contentPadding" style="color:#000; !important;padding: 28rpx 20rpx 0 !important;">
<view class="title-btn-d">
<view class="title-btn-sbtn" @tap="goSonPage('/package1/index/fireGoods')">
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/b46f57fed2604228bcd1801a156fafbc.jpg"
alt="" class="title-img" />
<text>热销商品</text>
</view>
<view class="title-btn-sbtn" @tap="goSonPage('/package1/index/order?listStatus=6')">
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/15211be8bbf74600ba90e040c57e2f45.jpg"
alt="" class="title-img" />
<text>待配货</text>
<text v-if="waitCount.waitAddProductCount > 0"
class="red-circle">{{waitCount.waitAddProductCount > 99 ? '99+' :waitCount.waitAddProductCount}}</text>
</view>
<view class="title-btn-sbtn" @tap="goSonPage('/package1/AI/AIHangOrderList')">
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/750b982236234011a959d1afe68a8069.jpg"
alt="" class="title-img" />
<text>挂单</text>
<text v-if="waitCount.registrationCount > 0"
class="red-circle">{{waitCount.registrationCount > 99 ? '99+' :waitCount.registrationCount}}</text>
</view>
<view class="title-btn-sbtn" @tap="goSonPage('/package1/index/shareStyle')">
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/83b7267c23b242d888385d7397542122.jpg"
alt="" class="title-img" />
<text>推款</text>
</view>
<view class="title-btn-sbtn" @tap="goSonPage('/package1/AI/AIInventoryList')">
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/01c48cc06cfb4f44aa304fbc26df048c.jpg"
alt="" class="title-img" />
<text>Ai入库</text>
<!-- <text v-if="waitCount.waitPurchaseCount > 0"
class="red-circle">{{waitCount.waitPurchaseCount > 99 ? '99+' :waitCount.waitPurchaseCount}}</text> -->
</view>
<!-- <view class="title-btn-sbtn" @tap="goSonPage('/pages/index/waitStorage?inStorageStatus=0')">
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/01c48cc06cfb4f44aa304fbc26df048c.jpg" alt="" class="title-img" />
<text>待入库</text>
<text v-if="waitCount.waitPurchaseCount > 0"
class="red-circle">{{waitCount.waitPurchaseCount > 99 ? '99+' :waitCount.waitPurchaseCount}}</text>
</view> -->
</view>
</view>
<view class="waimai" :style="{'right':waimaiRight}" @tap="quwaimai"></view>
<view class="contentPadding">
<view class="title">
<i class="iconfont icon-xiaoshouyuce"> 今日营收详情</i>
</view>
<u-grid :col="3">
<u-grid-item>
<u-count-to :start-val="0" :end-val="type==0?shopInfo.totalAmount:0" :decimals="2"></u-count-to>
<text class="grid-text">销售总金额</text>
</u-grid-item>
<u-grid-item @tap="showPayType">
<u-count-to :start-val="0" :end-val="type==0?shopInfo.totalAlreadyEarn:0"></u-count-to>
<text class="grid-text">今日实收</text>
<uni-icons type="help" size="21"
style="position: absolute;bottom: 35rpx;right: 10rpx;"></uni-icons>
</u-grid-item>
<u-grid-item @tap='shijiPrice = true'>
<u-count-to :start-val="0" :end-val="type==0?(shopInfo.totalProfit-shopInfo.returnTotalAmount+shopInfo.saleReturnCost).toFixed(2):0" :decimals="2"></u-count-to>
<view class="grid-text">今日利润</view>
<uni-icons type="help" size="21"
style="position: absolute;bottom: 35rpx;right: 10rpx;"></uni-icons>
</u-grid-item>
</u-grid>
<view style="display: flex;text-align: center;font-size: 30rpx;">
<view class="title-four">
<view style="line-height:80rpx;font-size:34rpx;">{{shopInfo.totalCCount}}</view>
<view>下单客户</view>
</view>
<view class="title-four">
<view style="line-height:80rpx;font-size:34rpx;">{{shopInfo.totalJCount}}</view>
<view>销售件数</view>
</view>
<view class="title-four">
<view style="line-height:80rpx;font-size:34rpx;">{{shopInfo.returnTotalAmount}}</view>
<view>退货金额</view>
</view>
<view class="title-four">
<view style="line-height:80rpx;font-size:34rpx;">{{shopInfo.returnTotalCount}}</view>
<view>退货数</view>
</view>
</view>
</view>
<view class="contentPadding" v-if="type==0">
<view class="title">
<i class="iconfont icon-huaban"> 本周营收统计
<view class="btn" @tap="gotoSearchData">
数据统计 >
</view>
</i>
</view>
<qiun-data-charts type="column" :opts="opts" :chartData="chartData" canvas2d="true"
canvasId="canvsaId1" />
</view>
<view class="contentPadding">
<view class="title">
<i class="iconfont icon-wenjianliebiao"> 近期订单列表</i>
</view>
<ul class="inventoryList" v-if="inventoryList.length > 0">
<li v-for="item in inventoryList" :key="item.id">
<uni-card :title="item.userName == null ?'暂无':item.userName"
:sub-title="'¥'+(item.totalAmount == null ?'暂无':item.totalAmount)" :thumbnail="item.img"
@tap="gotoDetail(item.id)">
<view class="uni-body">{{ item.createByName == null ?'暂无':item.createByName}} -
{{ item.createTime }}
</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>
<view class="floatRight" v-if="item.status == 4 || item.status == 1 || item.status == 0" @tap.stop="cancelOrder(item)">撤销</view>
<view class="floatRight" v-if="item.status == 4 || item.status == 1 || item.status == 0" @tap.stop="cancelOrder(item,'goPay')">撤销并复制
</view>
</uni-card>
</li>
</ul>
<u-empty v-else mode="order" text="暂无订单,快去开单吧!"></u-empty>
</view>
</view>
<view>
<scroll-view scroll-y="true" style="height: 100%;">
<u-popup :show="settingShow" @close="settingShow = false" closeOnClickOverlay mode="left" safeAreaInsetTop>
<view class="popup-content" style="height: 1375rpx;">
<!-- <view class="content-avatar">
<u-avatar :src="avatar"></u-avatar>
<view class="shop-name">{{ shopName }}</view>
</view> -->
<view style="z-index:999">
<u-cell-group>
<u-cell icon="grid-fill" url="/pages/index/checkShop" title="切换当前店铺" clickable isLink
arrow-direction="left"></u-cell>
<view class="border-line"></view>
<u-cell icon="man-add-fill" url="/package1/index/peopleList?popleType=gysName&noClick=1"
title="供货商管理" clickable isLink arrow-direction="left"></u-cell>
<!-- <u-cell icon="man-add-fill" url="/pages/index/upstream" v-if="type==0" title="供货商欠款"
clickable isLink arrow-direction="left"></u-cell> -->
<u-cell icon="man-add-fill" url="/package1/index/waitStorage?inStorageStatus=1" title="采购单历史"
clickable isLink arrow-direction="left"></u-cell>
<u-cell icon="man-add-fill" url="/package1/inventory/inventoryReturnList" title="采购退货"
clickable isLink arrow-direction="left"></u-cell>
<u-cell icon="man-add-fill" url="/package1/stock/goodsStock" title="盘点管理" clickable isLink
arrow-direction="left"></u-cell>
<view class="border-line"></view>
<u-cell icon="account-fill" url="/package1/index/peopleList?popleType=khName&noClick=1"
title="客户管理" clickable isLink arrow-direction="left"></u-cell>
<u-cell icon="account-fill" url="/package1/index/customClassList"
title="客户分类" clickable isLink arrow-direction="left"></u-cell>
<!-- <u-cell icon="account-fill" url="/pages/index/downstream" v-if="type==0" title="客户欠款"
clickable isLink arrow-direction="left"></u-cell> -->
<u-cell icon="account-fill" url="/package1/index/order?type=dingdan" title="销售单历史" clickable
isLink arrow-direction="left"></u-cell>
<u-cell icon="account-fill" url="/package1/index/returnOrder" title="退货单历史" clickable
isLink arrow-direction="left"></u-cell>
<view class="border-line"></view>
<!-- <u-cell icon="home-fill" url="/package1/index/warehouseList"
title="仓库管理" clickable isLink arrow-direction="left"></u-cell>
<u-cell icon="home-fill" url="/package1/index/shopAssociation"
title="店铺关联组" clickable isLink arrow-direction="left"></u-cell> -->
<view class="border-line"></view>
<u-cell icon="rewind-right-fill" url="/package1/index/updateShopMsg" title="更新店铺信息" clickable
isLink arrow-direction="left"></u-cell>
<u-cell v-if="shopName == '提钱' || shopName == '测试库新店' || shopName == '提钱退休'"
icon="integral-fill" url="/package1/AI/addAiList" title="管理员登录" clickable isLink
arrow-direction="left"></u-cell>
<!-- <u-cell icon="integral-fill" url="" title="电费缴纳" clickable isLink
arrow-direction="left"></u-cell>
<u-cell icon="integral-fill" url="" title="租金缴纳" clickable isLink
arrow-direction="left"></u-cell> -->
<u-cell icon="rewind-right-fill" url="/pages/rebate/rebateShare" title="邀请返佣" clickable
isLink arrow-direction="left"></u-cell>
<!-- <u-cell icon="heart-fill" url="/package1/index/publicWelfare" title="公益公示" clickable isLink
arrow-direction="left"></u-cell> -->
<u-cell icon="heart-fill" url="/package1/other/tutorialList" title="使用教程" clickable isLink
arrow-direction="left"></u-cell>
<u-cell icon="server-man" url="/package1/index/feedBack" title="问题反馈" clickable isLink
arrow-direction="left"></u-cell>
<u-cell icon="setting-fill" url="/pages/index/shopInfo" title="修改个人信息" clickable isLink
arrow-direction="left"></u-cell>
<!-- <u-cell icon="setting-fill" url="/pages/index/shopInfo" title="设置" clickable isLink
arrow-direction="left"></u-cell> -->
<u-cell icon="rewind-left-fill" @click="outLogin" title="退出登录" clickable isLink
arrow-direction="left"></u-cell>
</u-cell-group>
</view>
</view>
</u-popup>
</scroll-view>
</view>
<!-- 宣传页 -->
<uni-popup ref="publicizepopup" background-color="#fff">
<view class="publicize-content">
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/baa8e7c7b38d4feabeed8cf43f49ccfb.png"
alt="宣传图">
<view class="pop-close" @tap="popClose">X</view>
</view>
</uni-popup>
<view v-if="showDayPrice" :style="{height:(80 + shopInfo.totalAlreadyEarnDetail.length * 80)+ 'rpx'}"
style="position: fixed;margin:auto;left:0;right:0;top:0;bottom:0;width:200px;background: rgba(0,0,0,0.7);border-radius: 10px;color: #eee;">
<view style="width:100%;height:80rpx;font-size: 30rpx;text-align: center;line-height: 80rpx;">
今日收款方式统计
</view>
<view v-for="(item,index) in shopInfo.totalAlreadyEarnDetail" :key="index"
style="text-align: center;line-height: 80rpx;">
<view>
{{item.payType == 0?'现金收款:':item.payType == 1?'微信收款:':item.payType == 2?'支付宝收款:':item.payType == 3?'银行卡收款:':item.payType == 4?'收款码收款:':''}}{{item.payAmount}}元
</view>
</view>
</view>
<view v-if="showFormula"
style="height:230rpx;position: fixed;z-index:999;margin:auto;left:0;right:0;top:0;bottom:0;width:200px;background: rgba(0,0,0,0.7);border-radius: 10px;color: #eee;">
<view style="width:100%;height:80rpx;font-size: 30rpx;text-align: center;line-height: 80rpx;">
{{showDan == 0?'销售利润':showDan == 1?'实际利润':showDan == 2?'实际利润率':showDan == 3?'销售利润率':''}}计算公式
</view>
<view style="text-align: center;line-height: 40rpx;">
<view v-if="showDan == 3" style="margin-top: 20rpx;">
<view>公式:销售利润/销售金额*100</view>
<view>{{shopInfo.totalProfit}}/{{shopInfo.totalAmount}}*100={{(shopInfo.totalProfit == 0 && shopInfo.totalAmount == 0)?0:((shopInfo.totalProfit/shopInfo.totalAmount)*100).toFixed(2)}}%</view>
</view>
<view v-if="showDan == 2" style="margin-top: 20rpx;">
<view>公式:实际利润/(销售金额-退货金额)</view>
<view>{{(shopInfo.totalAmount-(shopInfo.totalAmount-shopInfo.totalProfit)-shopInfo.returnTotalAmount+shopInfo.saleReturnCost).toFixed(2)}}/{{shopInfo.totalAmount - shopInfo.returnTotalAmount}} * 100={{(shopInfo.totalProfit-shopInfo.returnTotalAmount+shopInfo.saleReturnCost)==0?0:(((shopInfo.totalProfit-shopInfo.returnTotalAmount+shopInfo.saleReturnCost)/(shopInfo.totalAmount-shopInfo.returnTotalAmount))*100).toFixed(2)}}%</view>
</view>
<view v-if="showDan == 1" style="margin-top: 20rpx;">
<view>公式:销售利润-(退货金额-退货成本)</view>
<view>{{shopInfo.totalProfit}}-({{shopInfo.returnTotalAmount}}-{{shopInfo.saleReturnCost}})={{(shopInfo.totalAmount-(shopInfo.totalAmount-shopInfo.totalProfit)-shopInfo.returnTotalAmount+shopInfo.saleReturnCost).toFixed(2)}}</view>
</view>
<view v-if="showDan == 0" style="margin-top: 20rpx;">
<view>公式:销售金额-销售成本</view>
<view>{{shopInfo.totalAmount}}-{{shopInfo.totalAmount - shopInfo.totalProfit}}={{shopInfo.totalProfit}}</view>
</view>
</view>
</view>
<view v-if="shijiPrice" style="width:100%;height:100%;position: fixed;top: 0;background: rgba(0,0,0,0.7);">
<view
style="position: fixed;margin:auto;height:660rpx;left:0;right:0;top:0;bottom:0;width:600rpx;background:#fff;border-radius: 10px;color: #000;">
<view style="width:100%;height:80rpx;font-size: 30rpx;text-align: center;line-height: 80rpx;font-weight: bold;">
利润明细
</view>
<view style="display: flex;">
<view style="width: 25%;display: flex;flex-direction: column;text-align: center;">
<text style="font-weight: bold;">{{shopInfo.totalAmount}}</text>
<text>销售金额</text>
</view>
<view style="width: 25%;display: flex;flex-direction: column;text-align: center;">
<text style="font-weight: bold;">{{(shopInfo.totalAmount - shopInfo.totalProfit).toFixed(2)}}</text>
<text>销售成本</text>
</view>
<view style="width: 25%;display: flex;flex-direction: column;text-align: center;">
<text style="font-weight: bold;">{{shopInfo.returnTotalAmount}}</text>
<text>退货金额</text>
</view>
<view style="width: 25%;display: flex;flex-direction: column;text-align: center;">
<text style="font-weight: bold;">{{shopInfo.saleReturnCost}}</text>
<text>退货成本</text>
</view>
</view>
<view style="width: 95%;height:380rpx;margin: 0 auto;margin-top: 20rpx;border-top: 1px solid #eee;">
<view style="background: #ecf5ff;width: 100%;color: #5fd9ee;height: 80rpx;line-height: 80rpx;padding-left: 10px;">
点击↓↓↓可查看计算公式
</view>
<view class="tan-lirun" @tap="changeFormula('0')">
<text style="font-weight: bold;margin-top: 20rpx;">{{shopInfo.totalProfit}}</text>
<text>销售利润</text>
</view>
<view @tap="changeFormula('1')" class="tan-lirun" style="float: right;" >
<text style="font-weight: bold;margin-top: 20rpx;">{{(shopInfo.totalAmount-(shopInfo.totalAmount-shopInfo.totalProfit)-shopInfo.returnTotalAmount+shopInfo.saleReturnCost).toFixed(2)}}</text>
<text>实际利润</text>
</view>
<view @tap="changeFormula('3')" class="tan-lirun">
<text style="font-weight: bold;margin-top: 20rpx;">{{(shopInfo.totalProfit == 0 || shopInfo.totalProfit == null) ?0:(shopInfo.totalAmount == 0 || shopInfo.totalAmount == null) ?0:((shopInfo.totalProfit/shopInfo.totalAmount)*100).toFixed(2)}}%</text>
<text>销售利润率</text>
</view>
<view @tap="changeFormula('2')" class="tan-lirun" style="float: right;">
<text style="font-weight: bold;margin-top: 20rpx;">{{((shopInfo.totalProfit-shopInfo.returnTotalAmount+shopInfo.saleReturnCost)==0 || (shopInfo.totalProfit-shopInfo.returnTotalAmount+shopInfo.saleReturnCost)==null)?0:((shopInfo.totalAmount-shopInfo.returnTotalAmount) == 0 || (shopInfo.totalAmount-shopInfo.returnTotalAmount) == null) ?0:(((shopInfo.totalProfit-shopInfo.returnTotalAmount+shopInfo.saleReturnCost)/(shopInfo.totalAmount-shopInfo.returnTotalAmount))*100).toFixed(2)}}%</text>
<text>实际利润率</text>
</view>
</view>
<view @tap="shijiPrice = false" style="height: 100rpx;width: 100%;line-height: 100rpx;text-align: center;border-top: 1px solid #eee;font-size: 40rpx;">
确定
</view>
</view>
</view>
</view>
</template>
<!-- cmd-nav-bar.vue index.vue pages.json -->
<script>
import cmdNavBar from "@/components/cmd-nav-bar/cmd-nav-bar.vue";
import {
mapState
} from 'vuex';
export default {
computed: mapState(['userId', 'shopIndex', 'avatar']),
data() {
return {
type: '',
src: 'http://pic2.sc.chinaz.com/Files/pic/pic9/202002/hpic2119_s.jpg',
inventoryList: [],
settingShow: false,
showFormula: false,
chartData: {},
showDan:'',
returnList:new Map(),
shopName: '',
waimaiRight:'-70rpx',
showDayPrice: false,
shijiPrice:false,
opts: {
padding: [15, 10, 0, 15],
dataLabel: true,
dataPointShape: false,
enableScroll: false,
legend: {},
xAxis: {
disableGrid: true
},
yAxis: {
gridType: "dash",
dashLength: 2,
data: [{
min: 0
}]
},
extra: {
column: {
type: "group",
width: 30,
customColor: ["#44fd6d", "#91CB74"],
activeBgColor: "#000000",
activeBgOpacity: 0.08,
seriesGap: 10,
barBorderCircle: true,
barBorderRadius: [
20,
20,
0,
0
],
linearType: "custom"
}
},
},
shopInfo: {
totalAmount: 0,
totalAlreadyEarn: 0,
totalPayAmount: 0,
totalCCount: 0,
totalCount: 0,
totalJCount: 0,
totalProfit: 0,
saleReturnCost:0,
returnTotalAmount: 0,
returnTotalCount: 0,
totalAlreadyEarnDetail: 0
},
waitCount: {},
enDayShow:false,
endDay:'',
textArr:[]
}
},
components: {
cmdNavBar
},
filters: {
spliceMsg(val) {
val == null || undefined ? '暂无' : val
return val;
}
},
onShow() {
this.getSaleInfo()
this.getEndTime()
},
onLoad() {
let that = this;
wx.getLocation({
type: 'gcj02',
success(res) {
}
})
uni.getStorage({
key: 'shopName',
success: function(res) {
that.shopName = res.data
}
});
uni.getStorage({
key: 'type',
success: function(res) {
that.type = res.data
}
});
var today = new Date();
var day = today.getDate();
//宣传页
if (uni.getStorageSync('publicize') == day) {
} else {
uni.setStorageSync("publicize", day)
this.$refs.publicizepopup.open('center')
}
},
onTabItemTap(e) {
this.getSaleInfo()
},
methods: {
//获取店铺到期时间
getEndTime(){
this.textArr = []
this.tui.request("/app/shop/getShopInfoById", "post", {
id: uni.getStorageSync('shopId')
}, false, true).then((res) => {
uni.setStorageSync('endTime',res.result.endTime)
this.endTime = res.result.endTime
this.endDay = this.daysUntil(res.result.endTime)
if(this.endDay < 7){
this.enDayShow = true
}
})
setTimeout(res1=>{
if(this.endTime != undefined){
let text = '您的店铺有效期至'+this.endTime+',还有'+this.endDay+'天到期,请及时联系管理员续费或开通'
this.textArr.push(text)
console.log(this.textArr)
}
},500)
},
daysUntil(dateStr) {
const targetDate = new Date(dateStr);
const currentDate = new Date();
const differenceInMs = targetDate - currentDate;
const daysDifference = Math.ceil(differenceInMs / (1000 * 60 * 60 * 24));
return daysDifference;
},
changeFormula(type){
console.log(type)
this.showFormula = true
this.showDan = type
setTimeout(res=>{
this.showFormula = false
},2000)
},
popClose() {
this.$refs.publicizepopup.close()
},
//退款接口
async getReturnOrder(id) {
let that = this;
await this.tui.request("/app/return/list", "post", {
remark: 3,
saleId: id
}, false, false).then((res) => {
if (res.code == 200 && res.result != null && res.result != undefined) {
if (res.result != '') {
res.result.forEach(item => {
this.tui.request("/app/return/get/" + item.id, "GET", null, false,false).then((res) => {
if (res.code == 200 && res.result != null && res.result != undefined) {
for(let i=0;i<res.result.saleDetailDTOList.length;i++){
res.result.saleDetailDTOList[i].returnPrice = res.result.saleDetailDTOList[i].discountAmount
res.result.saleDetailDTOList[i].stockLogList = new Map()
that.returnList.set(res.result.saleDetailDTOList[i].productId,res.result.saleDetailDTOList[i])
for(let m=0;m<res.result.saleDetailDTOList[i].stockLogList1.length;m++){
res.result.saleDetailDTOList[i].stockLogList1[m].productCount = 0-res.result.saleDetailDTOList[i].stockLogList1[m].productCount
that.returnList.get(res.result.saleDetailDTOList[i].productId).stockLogList.set(res.result.saleDetailDTOList[i].stockLogList1[m].attributeList,res.result.saleDetailDTOList[i].stockLogList1[m])
}
}
}
}).catch((res) => {})
})
}
} else {
this.tui.toast(res.message)
}
})
},
// 取消订单
async cancelOrder(item, type) {
let that = this;
await this.getReturnOrder(item.id)
await this.tui.modal("提示", type=='goPay'?"您确定要撤销订单并重新开单吗?":"您确定要撤销订单吗?", true, (res) => {
if (res) {
that.cancelSale(item,type)
}
})
},
cancelSale(item,type){
this.tui.request('/app/sale/cancelSale', "POST", {
id:item.id
}, true, true).then((res1) => {
if (res1.code == 200) {
if (type == 'goPay') {
this.goSaleGoods(item,'cancel')
} else {
this.getSaleInfo()
}
} else {
this.tui.toast(res.message)
}
}).catch((res1) => {})
},
// 取消订单
getOrderInfoList(item,type) {
let that = this;
// if(item.status == 0 || item.status == 1){
// this.tui.request('/app/sale/status', "POST", {
// status: 4,
// orderId: item.id
// }, true, true).then((res1) => {
// if (res1.code == 200) {
this.cancelSale(item,type)
// } else {
// this.tui.toast(res.message)
// }
// }).catch((res1) => {})
// }else{
// this.cancelSale(item,type)
// }
},
sliceMsg(val) {
var name = ''
if (typeof(val) == 'string') {
let newObj = JSON.parse(val)
for (let as in newObj) {
name += newObj[as] + '/'
}
}
return name;
},
//带参数跳转到开单页
goSaleGoods(item,type) {
let dataList = []
if(item.saleDetailDTOList == null || item.saleDetailDTOList == ''){
item.saleDetailDTOList = []
}
this.returnList.forEach(function(value, key) {
item.saleDetailDTOList.push(value)
})
if (item.saleDetailDTOList) {
for (let i = 0; i < item.saleDetailDTOList.length; i++) {
let obj = {}
let attrMap = new Map()
let newSaleDetailDTOList = []
let num = 0
for (let m = 0; m < item.saleDetailDTOList[i].stockLogList1.length; m++) {
if (attrMap.has(item.saleDetailDTOList[i].stockLogList1[m].attributeList) == true) {
let hasCount = attrMap.get(item.saleDetailDTOList[i].stockLogList1[m].attributeList)
newSaleDetailDTOList[hasCount].productCount = Number(newSaleDetailDTOList[hasCount]
.productCount) + Number(item.saleDetailDTOList[i].stockLogList1[m].productCount)
} else {
item.saleDetailDTOList[i].stockLogList1[m].name = this.sliceMsg(item.saleDetailDTOList[i]
.stockLogList1[m].attributeList)
newSaleDetailDTOList.push(item.saleDetailDTOList[i].stockLogList1[m])
attrMap.set(item.saleDetailDTOList[i].stockLogList1[m].attributeList, num)
num++
}
}
obj.saleDetailQueryDTO = newSaleDetailDTOList
obj.num = 0
obj.id = item.saleDetailDTOList[i].productId
obj.attrId = item.saleDetailDTOList[i].attrId
obj.buyCount = item.saleDetailDTOList[i].buyCount - 1
obj.price = item.saleDetailDTOList[i].price
obj.lsprice = item.saleDetailDTOList[i].price
obj.discount = item.saleDetailDTOList[i].discount
obj.categoryId = item.saleDetailDTOList[i].categoryId
obj.zPrice = item.saleDetailDTOList[i].discountAmount
obj.customerCategoryRule = item.saleDetailDTOList[i].customerCategoryRule != null ?JSON.parse(item.saleDetailDTOList[i].customerCategoryRule):null
obj.productName = item.saleDetailDTOList[i].productName
obj.productPicture = item.saleDetailDTOList[i].productPicture + '?time=' + new Date().getTime()
obj.productSn = item.saleDetailDTOList[i].productSn
obj.wholesalePrice = item.saleDetailDTOList[i].wholesalePrice
obj.discountAmount = item.saleDetailDTOList[i].discountAmount
obj.returnPrice = item.saleDetailDTOList[i].returnPrice
obj.saleId = item.id
obj.remark = item.remark
obj.xsyId = item.createBy
obj.createByName = item.createByName
if(type == 'cancel'){
obj.unitPrice = this.getUnitPrice(item,item.saleDetailDTOList[i])
}else{
obj.unitPrice = item.saleDetailDTOList[i].discountAmount
}
dataList.push(obj)
}
} else {
let obj = {}
obj.num = 0
obj.price = 0
obj.saleId = item.id
obj.remark = item.remark
obj.xsyId = item.createBy
obj.createByName = item.createByName
dataList.push(obj)
}
this.$nextTick(()=>{
this.tui.request("/app/debt/selectByUserId", "post", {
shopId:uni.getStorageSync('shopId'),
userId:item.userId
}, false, true).then((res) => {
if (res.code == 200) {
this.returnList = new Map()
res.result.noEarn = res.result.amountOwed
res.result.name = res.result.userName
res.result.id = item.userId
uni.setStorageSync('khName', JSON.stringify(res.result))
uni.setStorageSync('carList1', JSON.stringify(dataList))
uni.setStorageSync('discountAll', item.discount != null ?item.discount:10)
uni.setStorageSync('hangOrder', true)
uni.switchTab({
url: '/pages/inventory/goodsList1'
})
}
})
})
},
getUnitPrice(item,items){
if(item.discount != 10){
if(item.discount == null || item.discount == 0 || item.discount ==undefined){
return items.discountAmount
}else{
return ((items.discountAmount * 10000) / (item.discount * 100) / 10).toFixed(2)
}
}else if(items.discount!= 10){
if(items.discount == null || items.discount == 0 || items.discount ==undefined){
return items.discountAmount
}else{
return ((items.discountAmount * 10000) / (items.discount * 100) / 10).toFixed(2)
}
}else{
return items.discountAmount || items.wholesalePrice
}
},
getSaleInfo() {
this.shopInfo = {
totalAmount: 0,
totalAlreadyEarn: 0,
totalPayAmount: 0,
totalCCount: 0,
totalCount: 0,
totalJCount: 0,
totalProfit: 0,
saleReturnCost:0,
returnTotalAmount: 0,
returnTotalCount: 0,
totalAlreadyEarnDetail: 0
}
this.inventoryList = []
this.tui.request("/app/sale/getShopAll", "POST", {
pageVo: {
pageSize: 5,
pageNumber: 1
},
}, false, false).then((res) => {
if (res.code == 200) {
this.shopInfo = {
totalAmount: res.result.totalAmount,
totalAlreadyEarn: res.result.totalAlreadyEarn,
totalPayAmount: res.result.totalPayAmount,
totalCCount: res.result.totalCCount,
totalCount: res.result.totalCount,
totalJCount: res.result.totalJCount,
totalProfit: res.result.totalProfit,
saleReturnCost:res.result.saleReturnCost,
returnTotalAmount: res.result.returnTotalAmount,
returnTotalCount: res.result.returnTotalCount,
totalAlreadyEarnDetail: res.result.totalAlreadyEarnDetail
}
let dataList = {
categories: this.getWeek(),
series: [{
name: "七天营收统计",
linearColor: [
[0, "#1890FF"],
[0.33, "#00B5FF"],
[0.66, "#00D1ED"],
[1, "#00E6BB"],
[1, "#90F489"]
],
setShadow: [3, 8, 10, "#00E6BB"],
data: res.result.weekSale
}]
};
this.chartData = JSON.parse(JSON.stringify(dataList));
this.waitCount = res.result.countMap
for (var i = 0; i < res.result.salePage.records.length; i++) {
res.result.salePage.records[i].img = '/static/images/dingdan/dd' + i + '.png'
this.inventoryList = res.result.salePage.records
}
} else {
this.tui.toast(res.message)
}
})
},
goToInfo() {
this.settingShow = true
},
//跳转外卖小程序
quwaimai() {
if(this.waimaiRight == '-70rpx'){
this.waimaiRight = '20rpx'
}else{
uni.openEmbeddedMiniProgram({
appId: 'wxf5362b6e97ecee2f'
})
}
setTimeout(res=>{
this.waimaiRight = '-70rpx'
},2000)
},
gotoSearchData() {
uni.navigateTo({
url: '/package1/index/dataStatistics'
})
},
showPayType() {
this.showDayPrice = true
setTimeout(res => {
this.showDayPrice = false
}, 2000)
},
outLogin(e) {
let that = this;
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.removeStorage({
key: 'hiver_token'
});
uni.navigateTo({
url: '/pages/login/login'
})
} else {
that.tui.toast(res.message)
}
})
}
}
})
},
getWeek() {
let days = 7
let week = ["周日", "周一", "周二", "周三", "周四", "周五", "周六"];
let dateList = Array.from({
length: days
}, (v, i) => i).map(day => {
let date = new Date();
date.setDate(date.getDate() - day);
return week[date.getDay()]
})
return dateList.reverse()
},
//跳转订单详情
gotoDetail(id) {
uni.navigateTo({
url: '/package1/index/orderDetail?id=' + id
})
},
//首页头部五个按钮的菜单
goSonPage(url) {
if (url == '/package1/index/waitStorage?inStorageStatus=0') {
if (this.type != 0) {
this.tui.toast('暂无查看权限!')
return;
}
}
uni.navigateTo({
url: url
})
}
}
}
</script>
<style lang="scss">
.IndexContent {
/*距离顶部范围应该在88-95范围内*/
padding-top: 160upx;
top: var(--status-bar-height);
.contentPadding {
padding: 28upx 20upx;
background-color: #fff;
color: #909399;
.title {
padding-left: 20rpx;
font-size: 32rpx;
color: #303133;
margin-bottom: 26rpx;
line-height: 66rpx;
image {
display: inline-block;
width: 40rpx;
vertical-align: middle;
}
.btn {
text-align: right;
width: 24%;
float: right;
font-size: 26rpx;
color: $u-primary;
}
}
.grid-text {
font-size: 28rpx;
margin-bottom: 26rpx;
}
}
}
.popup-content {
width: 450upx;
height: 100%;
overflow: scroll;
}
.content-avatar {
display: flex;
align-items: center;
margin: 25rpx 15rpx;
}
.shop-name {
margin-left: 15upx;
}
.title-dianpu {
margin-top: 14upx;
border-bottom: 1px solid #fff;
padding-bottom: 20upx;
}
.title-btn-d {
height: auto;
display: flex;
}
.dianpu-img {
width: 60upx;
height: 60upx;
float: left;
margin-left: 20upx;
}
.dianpu-text {
font-size: 40upx;
height: 60upx;
line-height: 65upx;
padding-left: 20upx;
}
.title-btn-sbtn {
flex: 1;
line-height: 40rpx;
text-align: center;
position: relative;
display: flex;
flex-direction: column;
font-size: 24rpx;
}
.title-btn-sbtn:hover {
color: #B22222;
}
.title-btn-sbtn:nth-child(1),
.title-btn-sbtn:nth-child(2) {
border-right: 1px solid #fff;
}
.red-circle {
position: absolute;
top: 0;
right: 0;
width: 40rpx;
height: 40rpx;
line-height: 40rpx;
font-size: 22rpx;
border-radius: 50%;
background: red;
color: #fff;
text-align: center;
}
.u-cell__body {
padding-left: 0 !important;
}
.u-cell__body__content {
padding-left: 10rpx;
}
.u-grid-item {
width: 30% !important;
height: 160rpx;
background-image: linear-gradient(#84C1FF, #C4E1FF) !important;
margin-left: 3%;
border-radius: 30rpx;
margin-top: 20rpx !important;
color: #fff !important;
}
.u-count-num {
color: #FFF !important
}
.status-bar {
height: 42px !important;
}
.u-icon {
padding: 0 0 0 8px !important;
}
.cmd-nav-bar {
height: 90rpx !important;
}
.uni-popup__wrapper {
background: rgba(255, 255, 255, 0) !important;
}
.publicize-content {
width: 600rpx;
height: 700rpx;
}
.publicize-content img {
width: 600rpx;
height: 600rpx;
border-radius: 50px;
}
.pop-close {
border: 1px solid #eee;
color: #eee;
border-radius: 50%;
width: 50rpx;
height: 50rpx;
line-height: 50rpx;
text-align: center;
margin: 40rpx auto;
}
.border-line {
width: 100%;
height: 15rpx;
background: #eee;
}
.uni-tooltip-popup {
width: 180rpx;
}
.waimai {
position: fixed;
bottom: 0;
background: url(https://jewel-shop.oss-cn-beijing.aliyuncs.com/cda1b75affd349118081f3880f815a0f.jpg) no-repeat;
background-size: 100%;
width: 130rpx;
height: 130rpx;
margin: 0 auto 10rpx;
z-index: 999;
}
.title-img {
width: 60rpx;
height: 60rpx;
margin: 0 auto;
}
.floatRight {
float: right;
padding: 14rpx;
color: $u-primary;
font-size: 26upx;
}
.title-four{
width: 23% !important;
height: 160rpx;
background-image: linear-gradient(#1AFD9C, #7AFEC6) !important;
margin-left: 2%;
border-radius: 30rpx;
margin-top: 20rpx !important;
color: #fff !important;
}
.u-notice-bar{
height: 60rpx;
line-height: 60rpx;
font-size: 30rpx;
}
.tan-lirun{
margin-top: 20rpx;
width: 45%;
height: 60px;
display: flex;
flex-direction: column;
text-align: center;
float: left;
background-image: linear-gradient(#84C1FF, #C4E1FF) !important;
color: #fff;
border-radius: 10px;
}
</style>