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.
 
 
 
 
 

1370 lines
39 KiB

<!-- 库存列表页 -->
<template>
<view class="page1">
<view class=""
style="width: 100%;display: flex;border-top: 1px solid #eee;border-bottom: 1px solid #eee;position: fixed;background: #fff;top: 0;z-index: 99;">
<view class="title-left">
<view class="title-left-box" style="color:blue;text-decoration: underline;" @tap="goWarnList">
<text>{{warnMsg.tailWarnCount}}</text>
<text>库存预警</text>
</view>
<view class="title-left-box">
<text>{{warnMsg.salesWeekCount}}</text>
<text>尾货预警</text>
</view>
<view class="title-left-box" style="color:blue;text-decoration: underline;" @tap="goRuku">
<text>{{total}}</text>
<text>待入库</text>
</view>
<view class="title-left-box" style="flex-direction: inherit;width: 66%;">
<view class="shop-box">
<view>{{warnMsg.productCount}}</view>
<view>商品数</view>
</view>
<view class="shop-box" @tap="seeStockCount(warnMsg.stockCount,warnMsg.minusStockCount)">
<view>{{warnMsg.stockCount + warnMsg.minusStockCount}}</view>
<view>
库存数
<uni-icons type="help" size="15"></uni-icons>
</view>
</view>
</view>
<view class="title-left-box" style="width: 34%;" @tap="clickModel">
<text>{{type ==0?warnMsg.stockCost:'0'}}</text>
<view>
库存成本
<uni-icons type="help" size="15"></uni-icons>
</view>
</view>
</view>
<view class="title-right">
<view class="title-right-top title-btn" @tap.stop="onGridClick('2')">
新增商品
</view>
<view class="title-right-bottom title-btn" @tap.stop="onGridClick('3')">
更多
</view>
</view>
</view>
<view class="search">
<uni-search-bar class="uni-mt-10" radius="5" placeholder="商品名称/货号/供应商" cancelButton="none" @input="search"
@clear="clearSearch" v-model="searchName" />
</view>
<view class="content-left" style="height: 78%;float: left;position: fixed;top: 23%;">
<view v-if="gateType == ''" class="left-box" v-for="(item, index) in indexList" :key="index"
:class="item.parentId ? 'left-box-hover':''" @tap="clickLeftBtn(index)">
<text style="width: 100%;height: 90rpx;line-height: 90rpx;display: inline-block;overflow: hidden;"
:class="item.parentId ? 'red' :''">{{item.categoryName}}</text>
</view>
</view>
<view class="content-right" style="width: 570rpx;background: #fff;margin-left:170rpx;margin-top: 300rpx;">
<view
style="display: flex;height: 60rpx;line-height: 60rpx;background: #C6E2FF;color: #777;text-align: center;">
<view style="width: 33%;">
款数:{{indexList[categoryIndex].count != undefined ? indexList[categoryIndex].count : 0}}
</view>
<view style="width: 46%;"
@tap.stop="seeStockCount(indexList[categoryIndex].stockCount,indexList[categoryIndex].minusStockCount)">
库存数:{{indexList[categoryIndex].stockCount != undefined ? indexList[categoryIndex].stockCount + indexList[categoryIndex].minusStockCount: 0}}
<uni-icons type="help" size="15" style="padding-right: 50rpx;"
@tap.stop="seeStockCount(indexList[categoryIndex].stockCount,indexList[categoryIndex].minusStockCount)"></uni-icons>
</view>
<view style="width: 17%;position: relative;" @tap.stop="goodsListSort">
排序
<uni-icons type="up" size="14" v-if="sort == ''"
style="position: absolute;top: -4px;right: 0;"></uni-icons>
<uni-icons type="down" size="14" v-if="sort == ''"
style="position: absolute;top: 6px;right: 0;"></uni-icons>
<uni-icons type="up" size="14" color='#FF6A6A' v-if="sort != '' && orderSort == 'asc'"
style="position: absolute;top: 0;right: 0;"></uni-icons>
<uni-icons type="down" size="14" color='#FF6A6A' v-if="sort != '' && orderSort == 'desc'"
style="position: absolute;top: 0;right: 0;"></uni-icons>
</view>
</view>
<view class="right-box" v-for="(item,index) in shopList" :key="index" @tap="goDetail(item)">
<view class="box-left" @tap.stop="largeImg(item)">
<img :src="item.productPicture" class="img-radius" alt="" v-if="item.productPicture">
<view class="noPic" v-else>暂无图片</view>
<view v-if="shopId == '1960543009070256129'" style="background: red;color: #fff;width: 100%;height: 30rpx;font-size: 20rpx;position: absolute;bottom: 0; text-align: center;border-radius: 5px;">
主播佣金{{item.commission == null ? 0:item.commission+'%'}}
</view>
</view>
<view class="box-right">
<view class="box-right-num">货号:{{item.productSn==null?'':item.productSn}}</view>
<view class="box-right-name">名称:{{item.productName == null?'暂无':item.productName}}</view>
<view class="box-right-name">供应商:{{item.supplierName == null?'暂无':item.supplierName}}</view>
<!-- 1上架 0下架 -->
<view class="up-down" v-if="item.delFlag ==1" @tap.stop="upDown('0',item)">下架</view>
<view class="up-down" v-if="item.delFlag ==0" @tap.stop="upDown('1',item)">上架</view>
<view @tap.stop="oneShare(item)"
style="position: absolute;top: 0;right: 20rpx;width: 100rpx;height: 80rpx;">
<button class="shareBtn">
<uni-icons type="redo" size="22"></uni-icons>
</button>
</view>
<view class="box-right-price" v-if ='shopId != "1960543009070256129"'>
<view class="price-box" v-if='type==0'>
<text
style="color: red;">{{item.inStorageStatus==0?'待入库':item.purchasePrice==null?'新商品':item.purchasePrice}}</text>
<text>采购价</text>
</view>
<view class="price-box">
<text>{{item.wholesalePrice}}</text>
<text>批发价</text>
</view>
<view class="price-box">
<text>{{item.price}}</text>
<text>零售价</text>
</view>
<view class="price-box" @tap.stop="seeStockCount(item.stockCount,item.minusStockCount)">
<text>{{item.stockCount + item.minusStockCount}}</text>
<view>
库存
<uni-icons type="help" size="15"></uni-icons>
</view>
</view>
</view>
<view class="box-right-price" v-else>
<view class="price-box" v-if='shopOwnerPhone == username || username == item.createBy'>
<text
style="color: red;">{{item.inStorageStatus==0?'待入库':item.purchasePrice==null?'新商品':item.purchasePrice+'%'}}</text>
<text>团长佣金</text>
</view>
<view class="price-box">
<text>{{item.wholesalePrice}}</text>
<text>直播价</text>
</view>
<view class="price-box">
<text>{{item.price}}</text>
<text>日常价</text>
</view>
<view class="price-box" @tap.stop="seeStockCount(item.stockCount,item.minusStockCount)">
<text>{{item.stockCount + item.minusStockCount}}</text>
<view>
库存
<uni-icons type="help" size="15"></uni-icons>
</view>
</view>
</view>
<view @tap.stop="seeCustomCategory(item.customerCategoryRule)"
style="padding: 4px 2px;position: absolute;right: 20rpx;bottom: 104rpx;background: #088FEB;border-radius: 5px;color: #fff;">
客户价格
</view>
</view>
</view>
<view class="right-box" v-for="(item,index) in shopList1" :key="index" @tap="goDetail(item)">
<view class="box-left" @tap.stop="largeImg(item)">
<img :src="item.productPicture" class="img-radius" alt="" v-if="item.productPicture">
<view class="noPic" v-else>暂无图片</view>
<view v-if="shopId == '1960543009070256129'" style="background: red;color: #fff;width: 100%;height: 30rpx;font-size: 20rpx;position: absolute;bottom: 0; text-align: center;border-radius: 5px;">
主播佣金{{item.commission == null ? 0:item.commission+'%'}}
</view>
</view>
<view class="box-right">
<view class="box-right-num">货号:{{item.productSn}}</view>
<view class="box-right-name">名称:{{item.productName == null?'暂无':item.productName}}</view>
<view class="box-right-name">供应商:{{item.supplierName == null?'暂无':item.supplierName}}</view>
<!-- 1上架 0下架 -->
<view class="up-down" v-if="item.delFlag ==1" @tap.stop="upDown('0',item)">下架</view>
<view class="up-down" v-if="item.delFlag ==0" @tap.stop="upDown('1',item)">上架</view>
<view @tap.stop="oneShare(item)"
style="position: absolute;top: 20rpx;right: 20rpx;width: 100rpx;height: 100rpx;">
<button class="shareBtn">
<uni-icons type="redo" size="22"></uni-icons>
</button>
</view>
<view class="box-right-price" v-if ='shopId != "1960543009070256129"'>
<view class="price-box" v-if='type==0'>
<text
style="color: red;">{{item.inStorageStatus==0?'待入库':item.purchasePrice==null?'新商品':item.purchasePrice}}</text>
<text>采购价</text>
</view>
<view class="price-box">
<text>{{item.wholesalePrice}}</text>
<text>批发价</text>
</view>
<view class="price-box">
<text>{{item.price}}</text>
<text>零售价</text>
</view>
<view class="price-box" @tap.stop="seeStockCount(item.stockCount,item.minusStockCount)">
<text>{{item.stockCount + item.minusStockCount}}</text>
<view>
库存
<uni-icons type="help" size="15"></uni-icons>
</view>
</view>
</view>
<view class="box-right-price" v-else>
<view class="price-box" v-if='shopOwnerPhone == username || username == item.createBy'>
<text
style="color: red;">{{item.inStorageStatus==0?'待入库':item.purchasePrice==null?'新商品':item.purchasePrice+'%'}}</text>
<text>团长佣金</text>
</view>
<view class="price-box">
<text>{{item.wholesalePrice}}</text>
<text>直播价</text>
</view>
<view class="price-box">
<text>{{item.price}}</text>
<text>日常价</text>
</view>
<view class="price-box" @tap.stop="seeStockCount(item.stockCount,item.minusStockCount)">
<text>{{item.stockCount + item.minusStockCount}}</text>
<view>
库存
<uni-icons type="help" size="15"></uni-icons>
</view>
</view>
</view>
<view @tap.stop="seeCustomCategory(item.customerCategoryRule)"
v-if="item.customerCategoryRule != null && item.customerCategoryRule != ''"
style="padding: 4px 2px;position: absolute;right: 20rpx;bottom: 104rpx;background: #088FEB;border-radius: 5px;color: #fff;">
客户价格
</view>
</view>
</view>
<u-loadmore :status="status" />
</view>
<!-- 弹出输入框 -->
<uni-popup ref="payDialog" background-color="#fff">
<view class="popup-pay-content">
<view class="popup-pay-title">
<text>请选择</text>
</view>
<view class="popup-pay-container" @tap="onGridClick('0')">
<text style="display: inline-block">分类管理</text>
</view>
<view class="popup-pay-container" @tap="onGridClick('4')">
<text style="display: inline-block">批量打印商品码</text>
</view>
<view class="popup-pay-container" @tap="onGridClick('5')">
<text style="display: inline-block">批量下架</text>
</view>
<view v-if="type == 0" class="popup-pay-container" @tap="onGridClick('6')">
<text style="display: inline-block">批量删除商品</text>
</view>
<view class="popup-pay-container" @tap="onGridClick('7')">
<text style="display: inline-block">标签模板</text>
</view>
</view>
</uni-popup>
<!-- 弹出输入框 -->
<uni-popup ref="sharePriceDialog" background-color="#fff">
<view class="popup-pay-content">
<view class="content-list" @tap.stop="goPopleList('khName')">
<view class="list-name">客户</view>
<view class="list-val">
<input type="text" placeholder="可选择客户" disabled :value="khName.name"
style="text-align: center;margin-top: 20rpx;">
<uni-icons type="right" size="16" style="margin-left: 80rpx;line-height: 80rpx;"></uni-icons>
</view>
</view>
<view class="popup-pay-title">
<text>选择商品价格</text>
</view>
<view class="popup-pay-container" @tap="checkPay('0')">
<text style="display: inline-block">以零售价分享</text>
</view>
<view class="popup-pay-container" @tap="checkPay('1')">
<text style="display: inline-block">以批发价分享</text>
</view>
<view v-for="(item,index) in customerCategoryList" :key="index" @tap="checkPay('3',item)" class="popup-pay-container">
<text style="display: inline-block">{{item.categoryName}}</text>
</view>
</view>
</uni-popup>
<!-- 弹出层 -->
<uni-popup ref="sharePopup" background-color="#fff">
<view style="height: 350rpx;">
<button open-type="share" @tap="$refs.sharePopup.close()" class="popup-photo">分享给微信好友</button>
<button @tap="getUserData" class="popup-photo">生成商品图</button>
<view @tap="$refs.sharePopup.close()" class="popup-photo"
style="border-bottom:0;border-top:10px solid #eee;">取消</view>
</view>
</uni-popup>
<!-- 弹出多图轮播 -->
<uni-popup ref="imgPopup" background-color="#fff">
<view class="showImg-box">
<swiper indicator-dots class="swiper-box" @change="lunbochange" circular autoplay
:current="swiperDotIndex">
<swiper-item v-for="(item, index) in bigImg" :key="index">
<view class="swiper-item">
<image mode='aspectFit' show-menu-by-longpress :src="item.productPicture" alt=""
style="width: 100%;height: 100%;border-radius: 10px;" />
</image>
</view>
</swiper-item>
</swiper>
</view>
</uni-popup>
<!-- 维护客户价格弹出层 -->
<uni-popup ref="customPopup" background-color="#fff">
<view class="popup-content" style="height: auto;max-height: 600rpx;margin-bottom: 0;">
<view v-for="(item,index) in customerCategoryList" :key="index">
<view style="height: 60rpx;line-height: 60rpx;">
{{item.categoryName}}
</view>
<input type="number" disabled v-model='item.categoryPrice'
style="height: 60rpx;padding-left: 20rpx;border: 1px solid #eee;border-radius: 10rpx;">
</view>
<view @tap="$refs.customPopup.close()"
style="text-align:center;margin-top:20rpx;width: 100%;height: 60rpx;line-height: 60rpx;background: #088FEB;color: #fff;">
确认
</view>
</view>
</uni-popup>
<!-- 显示正负库存弹窗 -->
<uni-popup ref="showPopup" background-color="#fff">
<view class="popup-pay-content" style="width: 550rpx;">
<view class="popup-pay-title">
<text>库存数</text>
</view>
<view style="width: 100%;height: 150rpx;">
<view
style="width: 200rpx;height: 130rpx;border: 3px solid #FFE4C4;border-radius: 10px;margin-top: 20rpx;padding-top: 10px;display: flex;flex-direction: column;text-align: center;float: left;margin-left: 20rpx;">
<text style="font-weight: bold;">
正数库存
</text>
<text style="font-size: 30rpx;color: #000;font-weight: bold;">
{{zheng}}
</text>
</view>
<view
style="width: 200rpx;height: 130rpx;border: 3px solid #FFE4C4;border-radius: 10px;margin-top: 20rpx;padding-top: 10px;display: flex;flex-direction: column;text-align: center;float: left;margin-left: 40rpx;">
<text style="font-weight: bold;">
负数库存
</text>
<text style="font-size: 30rpx;color: #000;font-weight: bold;">
{{fu}}
</text>
</view>
</view>
<view class="popup-pay-container" style="display: flex;margin-top: 50rpx;background: #89CFF0;">
<view @tap='$refs.showPopup.close()'
style="flex:1;text-align: center;border-right: 1px solid #eee;background: #088FEB;font-size:32rpx;">
确认
</view>
</view>
</view>
</uni-popup>
<view v-if="canvasshow">
<canvas canvas-id="myCanvas" :style="{height:canvasHeight+'px',width:canvasWidth+'px'}"></canvas>
</view>
</view>
</template>
<script>
import {
mapState
} from 'vuex';
export default {
computed: mapState(['shopIndex', 'region']),
data() {
return {
canvasshow: false,
size: 30,
indexList: [],
zheng: '0',
khName:[],
canvasWidth:0,
canvasHeight:0,
shopOwnerPhone:uni.getStorageSync('shopOwnerPhone'),
username:uni.getStorageSync('username'),
fu: '0',
bigImg: [],
swiperDotIndex: 0,
// status: 'loadmore',
pageNum: 1, //分页的页码
shopList: [],
categoryId: '', //分类id
shopId: '', //店铺id,
type: '',
orderSort: '',
shareSuccess: false,
sort: '',
FWHPic: 'https://jewel-shop.oss-cn-beijing.aliyuncs.com/f2ba2080aaa54c618c2e47df4f220087.png',
mini_program_openid:'',
unionid:'',
official_account_openid:'',
warnMsg: [],
goodsData: [],
searchName: '',
base64: '',
categoryIndex: 0,
windowHeight: 0,
shopList1: [],
picture: '',
gateType: '',
total: 0,
customerCategoryList:[]
}
},
onLoad(option) {
if (option.khid != undefined) {
uni.redirectTo({
url: "/package1/index/oneGoodsShare?khid=" + option.khid
})
}
let that = this
this.type = uni.getStorageSync('type')
uni.getSystemInfo({
success: function(info) {
that.windowHeight = info.windowHeight
}
});
this.getCustomerCategoryList()
},
onShareAppMessage() {
this.shareSuccess = true
uni.setStorageSync('noReload', true)
return {
title: uni.getStorageSync('shopName') +'给您推荐的商品',
imageUrl: this.picture,
path: '/package1/index/oneGoodsShare?khid=' + this.khid + '&userId='+this.khName.userId + '&mini_program_openid=' + this.khName.mini_program_openid + '&unionid=' + this.khName.unionid +'&official_account_openid='+ this.khName.official_account_openid + '&customId=' + this.khName.id
}
},
onReachBottom() {
if (this.pageNum >= this.pages) return;
// this.status = 'loading';
this.pageNum++;
if (this.gateType == 'search') {
this.getShareList('search');
} else {
this.getShareList();
}
},
onShow() {
let that = this;
this.shopId = uni.getStorageSync('shopId')
if (uni.getStorageSync('noReload') == true) {
this.searchName = ''
uni.removeStorageSync('noReload')
} else {
this.searchName = ''
this.getGategoryList()
}
// if(uni.getStorageSync('mini_program_openid')){
// this.getToken()
// }
if (this.shareSuccess) {
if (uni.getStorageSync('khName') && (this.khName.officialAccountOpenid == null || this.khName.officialAccountOpenid == '' || this.khName.officialAccountOpenid == 'null' || this.khName.officialAccountOpenid == undefined)) {
uni.showModal({
title: "提示",
content: "该客户没有关注公众号,无法接收消息通知,是否邀请用户关注?",
success: function(res) {
if (res.confirm) {
uni.previewImage({
urls: [that.FWHPic]
})
}
}
})
uni.removeStorageSync('khName')
}
this.shareSuccess = false
}
this.getWarnMsg()
this.getweiruku()
},
methods: {
upNew(){
let content = {
thing3:'炘钱的店铺上新',
time2:'2024-12-25'
}
this.tui.request("/social/wechat/sendWechatTempMessage", "post", {
tempId:'M45X8AmPi58c16M9YVTMEOhwEVEa9s5md-6i3TwjpRQ',
title:'店铺上新',
content:JSON.stringify(content),
pagePath:'package1/index/downStearmList',
upNewType:1,
userId:'1739537305905008640',
categoryId:""
}, false, false).then((res) => {
this.status = 'nomore';
if (res.code == 200) {
} else {
this.tui.toast(res.message)
}
}).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) => {})
},
//跳转到客户选择页
goPopleList(){
uni.navigateTo({
url: '/package1/index/peopleList?popleType=khName'
})
},
//获取客户分类
getCustomerCategoryList(){
this.tui.request("/app/customerCategory/getCustomerCategoryListByShopId", "POST", {
shopId:uni.getStorageSync('shopId')
}, false, true).then((res) => {
if (res.code == 200) {
if(res.result.length > 0){
this.customerCategoryList = res.result
for(let i=0;i<this.customerCategoryList.length;i++){
let data = {
categoryName:this.customerCategoryList[i].categoryName,
categoryId:this.customerCategoryList[i].id,
categoryPrice:""
}
this.customerCategoryList[i] = data
}
}else{
this.customerCategoryList = null
}
} else {
this.tui.toast(res.message)
}
}).catch((res) => {})
},
getUserData() {
let that = this;
if(this.goodsData.productPicture == null || this.goodsData.productPicture == ''){
this.tui.toast("暂无可展示的图片", 300)
return
}
uni.setStorageSync('noReload', true)
this.tui.request("/order/ow/getWechatQrcode", "post", {
// page: 'package1/index/oneGoodsShare',
page: 'package1/index/downStearmList',
scene: this.khid,
envVersion: __wxConfig.envVersion,
}, false, true).then((res1) => {
if (res1.code == 200) {
let imgA = res1.result;
uni.downloadFile({
url: imgA,
success: (res2) => {
this.base64 = res2.tempFilePath
uni.showLoading({
title: '请求中...'
})
setTimeout(res3 => {
uni.hideLoading()
that.getData()
}, 500)
}
});
} else {
this.tui.toast(res.message)
}
})
},
getData() {
let that = this
uni.showLoading({
title: '生成中...'
})
this.canvasshow = true
const ctx = uni.createCanvasContext('myCanvas', this);
//背景图
let imgA = this.goodsData.productPicture;
uni.getImageInfo({
src: imgA,
success: function(image) {
that.canvasWidth = image.width
if((image.height + 200) / image.width > 2){
that.canvasHeight = image.width * 2
image.height = that.canvasHeight * 0.8
}else{
that.canvasHeight = image.height / 0.8
}
ctx.setFillStyle('#fff');
ctx.fillRect(0, 0, that.canvasWidth, that.canvasHeight);
// // 绘制第一张图片
ctx.drawImage(image.path, 0, 0, image.width, image.height);
ctx.draw()
// 绘制第二张图片
ctx.drawImage(that.base64, 25, (that.canvasHeight * 0.8) + (that.canvasHeight * 0.2 * 0.15), (that.canvasHeight * 0.2 * 0.75), (that.canvasHeight * 0.2 * 0.75));
ctx.draw(true);
ctx.font = "20px 宋体";
// 设置字体样式
let codeWidth = that.canvasHeight * 0.2 * 0.75
ctx.setFontSize((codeWidth / 6).toFixed(0))
// 设置文字颜色
ctx.fillStyle = '#FF5809';
// 绘制文字
ctx.fillText(uni.getStorageSync('shopName'), (that.canvasHeight * 0.2 * 0.75) + 35 , (that.canvasHeight * 0.8) + (that.canvasHeight * 0.2 * 0.47));
// 设置字体样式
ctx.setFontSize((codeWidth / 7).toFixed(0))
// 设置文字颜色
ctx.fillStyle = '#000';
// 绘制文字
ctx.fillText('长按识别查看商品', (that.canvasHeight * 0.2 * 0.75) + 35 ,(that.canvasHeight * 0.8) + (that.canvasHeight * 0.2 * 0.47) + Number((codeWidth / 5).toFixed(0)));
ctx.draw(true,(()=>{
setTimeout(ress=>{
uni.canvasToTempFilePath({
x: 0,
y: 0,
width: that.canvasWidth,
height: that.canvasHeight,
destWidth: that.canvasWidth,
destHeight: that.canvasHeight,
canvasId: 'myCanvas',
success: (res3) => {
that.canvasshow = false
that.tempFilePath = res3.tempFilePath
uni.previewImage({
urls: [res3.tempFilePath]
})
uni.hideLoading()
}
});
},500)
})())
}
});
},
lunbochange(e) {
this.current = e.detail.current
},
//排序
goodsListSort() {
//sort空 stockCount desc asc
this.pageNum = 1
this.shopList1 = []
this.shopList = []
this.sort = 'stockCount'
if (this.orderSort == '') {
this.orderSort = 'asc'
} else if (this.orderSort == 'asc') {
this.orderSort = 'desc'
} else if (this.orderSort == 'desc') {
this.orderSort = 'asc'
}
this.getShareList()
},
largeImg(img) {
if ((img.productPicture == null && img.productPictures == null) || (img.productPicture == '' && img.productPictures == null)) {
this.tui.toast("暂无可展示的图片", 300)
return
}
this.bigImg = []
if (img.productPicture != null) {
let data = {
productPicture: img.productPicture
}
this.bigImg.push(data)
}
if (img.productPictures != null) {
for (let i = 0; i < img.productPictures.length; i++) {
this.bigImg.push(img.productPictures[i])
}
}
this.$refs.imgPopup.open()
},
checkPay(type,item) {
let obj = {
id: type=='3'?item.categoryId:'',
name: type=='3'?item.categoryName:'',
userId: this.khName.userId,
customId:this.khName.id,
mini_program_openid :this.khName.mini_program_openid,
unionid:this.khName.unionid,
official_account_openid:this.khName.official_account_openid
}
this.tui.request("/app/productShare/save", "POST", {
shareType: '2',
shareProductId: [this.goodsData.id],
priceType: type,
scene:JSON.stringify(obj)
}, false, true).then((res) => {
if (res.code == 200) {
this.khid = res.result.id+'-'
} else {
this.tui.toast(res.message)
}
}).catch((res) => {})
this.checkPayData = type
this.$refs.sharePriceDialog.close()
if(this.khName != ''){
uni.setStorageSync('khName',this.khName)
}
this.khName = ""
this.$refs.sharePopup.open('bottom')
},
seeStockCount(zheng, fu) {
this.zheng = zheng;
this.fu = fu;
this.$refs.showPopup.open()
},
//初始化获取分类列表
getGategoryList() {
this.tui.request("/app/productCategory/list", "get", {
// shopId: 1,
}, false, true).then((res) => {
if (res.code == 200) {
this.indexList = res.result;
for (var i = 0; i < this.indexList.length; i++) {
if (i == this.categoryIndex) {
this.indexList[i].parentId = true
} else {
this.indexList[i].parentId = false
}
}
this.categoryId = this.indexList[this.categoryIndex].id
this.pageNum = 1
this.searchName = ""
this.shopList1 = []
this.shopList = []
this.getShareList();
} else {
this.tui.toast(res.message)
}
}).catch((res) => {})
},
//获取库存预警信息
getWarnMsg() {
this.tui.request("/app/stock/getShopStock", "POST", {}, false, false).then((res) => {
if (res.code == 200) {
this.warnMsg = res.result
} else {
this.tui.toast(res.message)
}
}).catch((res) => {})
},
//点击左侧菜单切换
clickLeftBtn(index) {
uni.removeStorageSync('noReload')
for (var i = 0; i < this.indexList.length; i++) {
if (i == index) {
this.indexList[i].parentId = true
} else {
this.indexList[i].parentId = false
}
}
this.categoryIndex = index
this.categoryId = this.indexList[index].id
this.pageNum = 1
this.searchName = ""
this.orderSort = ""
this.sort = ''
this.shopList1 = []
this.shopList = []
this.getShareList()
},
//待入库
goRuku() {
uni.navigateTo({
url: '/package1/index/waitStorage?inStorageStatus=0'
})
},
getweiruku() {
this.tui.request("/app/purchase/list", "POST", {
inStorageStatus: 0
}, false, false).then((res) => {
this.status = 'nomore';
if (res.code == 200) {
this.total = res.result.total
} else {
this.tui.toast(res.message)
}
})
},
//库存详情
goDetail(item) {
uni.setStorageSync('noReload', true)
uni.navigateTo({
url: '/package1/inventory/inventoryDetail?item=' + JSON.stringify(item)
})
},
goWarnList() {
uni.navigateTo({
url: '/package1/inventory/inventoryWarn'
})
},
clickModel(type) {
if (type = "num") {
this.tui.toast("商品规格库存数为负数,则该规格库存数不计入库存总数中")
} else {
this.tui.toast("商品规格库存数为负数,则该规格的库存成本不计入总库存成本")
}
},
seeCustomCategory(item) {
if (item == null || item == '') {
this.tui.toast("暂无客户分类价格", 300)
} else {
this.customerCategoryList = JSON.parse(item)
if (Array.isArray(this.customerCategoryList)) {
this.$refs.customPopup.open()
} else {
this.tui.toast("暂无客户分类价格", 300)
}
}
},
//点击分类获取商品列表
getShareList(type) {
uni.showLoading({
title: '加载中...',
mask: true
})
let data = {}
if (type == 'search') {
this.gateType = 'search'
data = {
categoryId: "",
searchStr: this.searchName,
pageNum: this.pageNum,
pageSize: '10',
sort: "",
order: ""
}
} else {
this.gateType = ''
data = {
categoryId: this.categoryId,
searchStr: this.searchName,
pageNum: this.pageNum,
pageSize: '10',
sort: this.sort,
// supplierId: "1819981229722832896",
order: this.orderSort
}
}
this.status = 'loading';
this.tui.request("/app/product/getShareList", "POST", data, false, false).then((res) => {
if (res.code == 200) {
if (type == 'search') {
this.shopList = []
this.status = 'nomore';
if (this.pages == 1) {
this.shopList1 = res.result.records
} else {
this.shopList1 = [...this.shopList1, ...res.result.records]
}
this.pages = res.result.pages
} else {
this.shopList1 = []
this.status = 'nomore';
if (this.pages == 1) {
this.shopList = res.result.records
} else {
this.shopList = [...this.shopList, ...res.result.records]
}
this.pages = res.result.pages
}
} else {
this.tui.toast(res.message)
}
}).catch((res) => {})
uni.hideLoading()
},
oneShare(item) {
this.goodsData = item
this.picture = (item.productPicture == null || item.productPicture == "") ?
'https://jewel-shop.oss-cn-beijing.aliyuncs.com/70c3d9a274ff4feeb6df0bcb8be0f733.jpg' : item
.productPicture
if(this.shopId == '1960543009070256129'){
this.checkPay('1')
}else{
this.$refs.sharePriceDialog.open()
}
},
//商品上下架
upDown(type, data) {
let that = this,
title = "确定将此款商品" + (type == 0 ? "下架" : "上架") + "吗?"
uni.showModal({
title: "提示",
content: title,
success: function(res) {
if (res.confirm) {
that.pageNum = 1
that.searchName = ""
that.shopList1 = []
that.shopList = []
if (type == 0) { //下架
that.tui.request("/app/product/down", "POST", {
id: data.id
}, false, true).then((res) => {
if (res.code == 200) {
that.tui.toast("下架成功")
} else {
that.tui.toast(res.message)
}
that.categoryId = data.categoryId
that.getShareList()
}).catch((res) => {})
} else { //上架
that.tui.request("/app/product/up", "POST", {
id: data.id
}, false, true).then((res) => {
if (res.code == 200) {
that.tui.toast("上架成功")
} else {
that.tui.toast(res.message)
}
that.categoryId = data.categoryId
that.getShareList()
}).catch((res) => {})
}
}
}
})
},
//搜索接口
search(e) {
if (e == '') {
this.pageNum = 1
this.shopList1 = []
this.shopList = []
this.searchName = ""
this.getShareList()
} else {
this.pageNum = 1
this.shopList1 = []
this.shopList = []
this.searchName = e
this.getShareList('search')
}
},
//清空搜索条件
clearSearch() {
this.pageNum = 1
this.shopList1 = []
this.shopList = []
this.orderSort = ''
this.sort = ''
this.searchName = ''
this.getShareList()
},
//点击头部 更多 和 新增入库 按钮
onGridClick(target) {
if (target == '0') {
uni.navigateTo({
url: '/package1/inventory/gategory'
})
this.$refs.payDialog.close()
} else if (target == '1') {
// this.$refs.popup.open('bottom')
uni.navigateTo({
url: '/pages/inventory/addinventory'
})
} else if (target == '2') {
uni.navigateTo({
url: "/package1/inventory/addGoods"
})
this.$refs.payDialog.close()
} else if (target == '3') {
this.$refs.payDialog.open('center')
} else if (target == '4') {
uni.navigateTo({
url: "/package1/inventory/batchPrint"
})
this.$refs.payDialog.close()
} else if (target == '5') {
uni.navigateTo({
url: "/package1/inventory/goodsDelisting"
})
this.$refs.payDialog.close()
} else if (target == '7') {
uni.navigateTo({
url: "/package1/index/labelTemplate"
})
this.$refs.payDialog.close()
} else {
uni.navigateTo({
url: "/package1/inventory/goodsDelete"
})
this.$refs.payDialog.close()
}
}
}
}
</script>
<style lang="scss">
page,.page1{
font-size: 28rpx;
}
.search {
width: 100%;
height: 7%;
background-color: #fff;
position: fixed;
top: 200rpx;
z-index: 99;
}
.title-left {
width: 70%;
display: flex;
flex-wrap: wrap;
float: left;
}
.title-right {
width: 30%;
border-left: 1px solid #eee;
background: #fff;
}
.title-left-box {
display: flex;
flex-direction: column;
text-align: center;
width: 33%;
height: 100rpx;
padding-top: 20rpx;
.shop-box {}
}
// 偶数行
.title-left-box:nth-child(even) {
border-left: 1px solid #fff;
background: #fff;
}
//奇数行
.title-left-box:nth-child(odd) {
border-right: 1px solid #fff;
background: #fff;
}
.title-btn {
width: 70%;
height: 80rpx;
color: #fff;
border-radius: 10px;
text-align: center;
line-height: 80rpx;
margin: 10rpx auto 10rpx;
}
.shop-box {
width: 50%;
}
.title-right-top {
background: linear-gradient(90deg, #FF9797, #FFC1E0);
margin-top: 10px;
}
.title-right-bottom {
background: linear-gradient(90deg, #60F3FF, #088FEB);
}
.content-box {
background: #fff;
flex: 1;
display: flex;
overflow: scroll;
}
.content-left {
width: 170rpx;
background: #eee;
height: 100%;
overflow: scroll;
}
.left-box {
width: 100%;
height: 90rpx;
font-size: 30rpx;
text-align: center;
line-height: 90rpx;
border-bottom: 1px solid #fff;
}
.left-box-hover {
width: 100%;
height: 90rpx;
font-size: 30rpx;
text-align: center;
line-height: 90rpx;
border-bottom: 1px solid #fff;
background-color: #fff;
}
.red {
border-right: 3px solid red;
}
.content-right {
width: 550rpx;
height: 78%;
overflow-y: scroll;
}
.right-box {
width: 100%;
height: 250rpx;
display: flex;
border-bottom: 1px solid #eee;
position: relative;
}
.box-left {
width: 130rpx;
height: 131rpx;
background-size: 100%;
margin: 25rpx 30rpx 35rpx 10rpx;
border-radius: 20rpx;
position: relative;
}
.box-left img {
width: 140rpx;
height: 100%;
}
.box-right {
width: 100%;
margin-top: 17rpx;
}
.box-right-price {
width: 100%;
display: flex;
font-size: 25rpx;
}
.price-box {
width: 25%;
display: flex;
flex-direction: column;
margin-top: 10rpx;
}
.box-right-name {
font-size: 26rpx;
height: 50rpx;
line-height: 50rpx;
}
.box-right-num {
padding: 5rpx 0;
color: #000;
font-weight: bold;
font-size: 30rpx;
}
.price-box text:first-child {
color: #ffa200
}
.uni-mt-10 {
position: relative;
width: 100% !important;
float: left !important;
}
.uni-searchbar,
.uni-searchbar__box {
width: 100% !important;
padding: 5px 10px !important
}
.up-down {
position: absolute;
bottom: 10rpx;
left: 10rpx;
color: #fff;
background: #088FEB;
padding: 10rpx 10rpx;
border-radius: 5px;
width: 140rpx;
text-align: center;
}
.noPic {
border-radius: 10px;
width: 130rpx;
height: 130rpx;
// margin: 30rpx 0 0 30rpx;
text-align: center;
line-height: 140rpx;
color: #777;
background: #eee;
}
.popup-pay-content {
align-items: center;
justify-content: center;
padding: 15px;
width: 500rpx;
height: auto;
background-color: #fff;
}
.popup-pay-title {
font-size: 36rpx;
font-weight: bold;
text-align: center;
position: relative;
}
.popup-pay-container {
margin-top: 20rpx;
height: 100rpx;
border-radius: 10px;
background: #088FEB;
line-height: 100rpx;
text-align: center;
border-bottom: 1px solid #eee;
border-top: 1px solid #eee;
color: #fff;
}
.showImg-box {
width: 700rpx;
height: 1000rpx;
border-radius: 10px;
}
.swiper-box {
height: 1000rpx;
}
.swiper-item {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
height: 1000rpx;
color: #fff;
background-color: #cee1fd;
border-radius: 10px;
}
.popup-photo {
height: 110rpx;
line-height: 110rpx;
text-align: center;
font-size: 36rpx;
font-weight: 800;
border-bottom: 1px solid #eee;
}
.vue-ref {
padding-bottom: 0 !important;
}
.shareBtn {
background: rgba(255, 255, 255, 0);
width: 90rpx;
height: 50;
height: 80rpx;
line-height: 80rpx;
border: 1px solid #fff;
background-color: rgba(255, 255, 255, 0);
}
.shareBtn::after {
border: none;
}
.popup-photo {
height: 110rpx;
line-height: 110rpx;
text-align: center;
font-size: 36rpx;
font-weight: 800;
border-bottom: 1px solid #eee;
}
@media screen and (min-width: 470px) {
/* 适配宽度为375px及以上的屏幕 */
.content-left {
height: 75% !important;
float: left;
position: fixed;
top: 25% !important;
}
}
@media screen and (min-width: 760px) {
/* 适配宽度为375px及以上的屏幕 */
.content-left {
height: 70% !important;
float: left;
position: fixed;
top: 29% !important;
padding-top:50px;
}
}
.popup-content {
align-items: center;
justify-content: center;
padding: 15px;
height: 1200rpx;
background-color: #fff;
margin-bottom: 80rpx;
overflow: scroll;
}
.content-list {
width: 100%;
display: flex;
height: 80rpx;
border-bottom: 1px solid #eee;
}
.list-name {
width: 100rpx;
text-align: left;
line-height: 80rpx;
height: 80rpx;
font-size: 36rpx;
}
.list-val {
width: 345rpx;
height: 80rpx;
line-height: 80rpx;
display: flex;
}
</style>