修复bug

This commit is contained in:
weipengfei 2023-11-04 09:31:50 +08:00
parent 40c8b5725e
commit 9364edef73
4 changed files with 1083 additions and 716 deletions

View File

@ -7,6 +7,15 @@ import request from "@/utils/request.js";
export function microSeachBarCode(data) {
return request.get('micro/seach_bar_code', data);
}
/**
* 添加商品库审核
*
*/
export function microProductAdd(data) {
return request.post('micro/product_add', data);
}
/**
* 获取收款二维码
* @returns {*}

View File

@ -2,26 +2,112 @@
<view class="select_warehouse">
<view class="wrapper flex_a_c_j_sb">
<block v-for="item in goodsData" :key="item.name">
<view class="select_item" @click="navigato(item.type)"
:style="{'background-image': `url(${item.src})`}">
<view class="select_item select_item1" @click="navigato(item.type)" :class="'select_item'+item.type">
<view class="title">{{ item.name }}</view>
<view class="iconfont icon-jiantou"></view>
<!-- <view class="iconfont icon-jiantou"></view> -->
<image class="img" :src="item.src"></image>
</view>
</block>
</view>
<view class="list-box listA" :class="goods.length > 0 ? 'fadeIn on' : ''">
<view v-if="pageType==1" class="list-box-put">
<view class="item" v-for="(item, index) in goods" :key="index">
<view class="top">
<view class="pictrue">
<!-- <easy-loadimage mode="widthFix" :image-src="item.image"></easy-loadimage> -->
<image :src="item.image" :lazy-load="true"></image>
<image class="img" :src="item.image||defaultImageSRC" :lazy-load="true"></image>
<view class="swiper">
<image :src="item.slider_image[0]||defaultImageSRC" :lazy-load="true"></image>
<image :src="item.slider_image[1]||defaultImageSRC" :lazy-load="true"></image>
<image :src="item.slider_image[2]||defaultImageSRC" :lazy-load="true"></image>
</view>
</view>
<view class="text-info">
<view class="title">{{ item.store_name }}</view>
<view class="price">¥<text>{{ item.price }}</text></view>
<view class="title">
<view class="text_item_title">名称:</view>
<view style="color: #419aff;">{{ item.store_name }}</view>
</view>
<view class="text">
<view class="text_item">
<view class="text_item_title">规格: </view>
<view v-if="item.spec" v-html="item.spec"></view>
<view v-else></view>
</view>
<view class="text_item">
<view class="text_item_title">参考价格: </view>
<view>{{item.price||'0.00'}}()</view>
</view>
</view>
<view class="text">
<view class="text_item">
<view class="text_item_title">品牌: </view>
<view>{{item.trademark||'无'}}</view>
</view>
<view class="text_item">
<view class="text_item_title">分类: </view>
<view>{{item.goods_type||'无'}}</view>
</view>
</view>
<view class="text">
<view class="text_item">
<view class="text_item_title">厂商: </view>
<view>{{item.manu_name||'无'}}</view>
</view>
</view>
<view class="text">
<view class="text_item">
<view class="text_item_title">厂商地址: </view>
<view>{{item.manu_address||'无'}}</view>
</view>
</view>
<view class="text">
<view class="text_item">
<view class="text_item_title">备注: </view>
<u-read-more v-if="item.note" class="more" showHeight="50" :toggle="true" :fontSize="12"
:shadowStyle="shadowStyle" textIndent="0em" closeText="展开">
<text style="font-size: 24rpx;color: #333;" v-html="item.note"></text>
</u-read-more>
<text style="font-size: 24rpx;color: #333;" v-else></text>
</view>
</view>
</view>
</view>
<u-line></u-line>
<view class="bottom">
<view></view>
<view class="add-btn" @click="addGoods(item)">加入店铺</view>
</view>
</view>
</view>
<view v-if="pageType==2" class="photo-box">
<view class="card">
<view class="card-head">
<view class="text">请选择产品图片:</view>
<view>刷新: 3</view>
</view>
<view class="img-list">
<image class="img" src="https://lihai001.oss-cn-chengdu.aliyuncs.com/public/kk/luzhou/static4/saoma.png" v-for="item in 6" :key="item"></image>
</view>
</view>
<view class="card">
<view class="card-head">
<view class="text">请选择产品图片:</view>
</view>
<view class="img-list img-list2">
<image class="img" src="https://lihai001.oss-cn-chengdu.aliyuncs.com/public/kk/luzhou/static4/saoma.png" v-for="item in 2" :key="item"></image>
</view>
</view>
<view class="card">
<view class="card-head">
<view class="text">请选择产品图片:</view>
</view>
<view class="img-list">
<image class="img" src="https://lihai001.oss-cn-chengdu.aliyuncs.com/public/kk/luzhou/static4/saoma.png" v-for="item in 3" :key="item"></image>
</view>
</view>
</view>
<u-popup :show="editGoodsShow" @close="editGoodsClose" :round="18" mode="center">
<view class="edit_goods_box">
<view class="edit_name flex_a_c edit_name_no">
@ -48,15 +134,27 @@
@confirm="addGoodsopen()" :closeOnClickOverlay="true" :showCancelButton="true"></u-modal> -->
<u-popup :show="addGoodsShow" @close="searchGoodsClose" :round="18" mode="center">
<view class="search_goods_box">
<view style="text-align: center;font-weight: bold;">是否添加到你的仓库中?</view>
<view style="text-align: center;font-weight: bold;">完善商品信息</view>
<view v-if="showPutGoodsInput.store_name" style="display: flex;align-items: center;margin-top: 16rpx;">
<view style="margin-right: 20rpx;">名称:</view>
<input style="flex: 1;" type="text" v-model="putGoods.store_name" class="putGoods" placeholder="请输入商品名称">
</view>
<view style="display: flex;align-items: center;margin-top: 16rpx;">
<view style="margin-right: 20rpx;">价格:</view>
<input style="flex: 1;" type="text" v-model="putGoods.price" class="putGoods" :placeholder="`请设置商品价格`">
<input style="flex: 1;" type="text" v-model="putGoods.price" class="putGoods" :placeholder="`请输入商品价格`">
</view>
<view style="display: flex;align-items: center;margin-top: 16rpx;">
<view style="margin-right: 20rpx;">库存:</view>
<input style="flex: 1;" type="text" v-model="putGoods.stock" class="putGoods" placeholder="请输入商品库存">
</view>
<view v-if="showPutGoodsInput.spec" style="display: flex;align-items: center;margin-top: 16rpx;">
<view style="margin-right: 20rpx;">规格:</view>
<input style="flex: 1;" type="text" v-model="putGoods.spec" class="putGoods" placeholder="请输入商品规格">
</view>
<view v-if="showPutGoodsInput.trademark" style="display: flex;align-items: center;margin-top: 16rpx;">
<view style="margin-right: 20rpx;">品牌:</view>
<input style="flex: 1;" type="text" v-model="putGoods.trademark" class="putGoods" placeholder="请输入商品品牌">
</view>
<view class="search_goods_btn">
<view class="cancel edit_btn" @click="addGoodsclose()">取消</view>
<view class="search edit_btn" @click="addGoodsopen()">确定</view>
@ -72,6 +170,7 @@
</view>
</view>
</u-popup>
<u-modal :show="showModel" title="提示" content="没有找到该商品,是否添加?"></u-modal>
</view>
</template>
@ -82,7 +181,8 @@
} from '@/api/product.js'
import {
microSeachBarCode,
microEadtProduct
microEadtProduct,
microProductAdd
} from '@/api/store.js'
import {
seachBarCodeAPI,
@ -94,17 +194,33 @@
export default {
data() {
return {
goodsData: [{
name: '商品名称添加',
pageType: 1, // , 1, 2
goodsData: [
{
name: '搜索名称入库',
type: 1,
src: 'https://lihai001.oss-cn-chengdu.aliyuncs.com/public/kk/luzhou/static4/mingcheng.png'
// src: 'https://lihai001.oss-cn-chengdu.aliyuncs.com/public/kk/luzhou/static4/mingcheng.png'
src: '/static/images/SMRK/name.png'
},
{
name: '扫码入库',
name: '标品扫码入库',
type: 2,
src: 'https://lihai001.oss-cn-chengdu.aliyuncs.com/public/kk/luzhou/static4/saoma.png'
}
// src: 'https://lihai001.oss-cn-chengdu.aliyuncs.com/public/kk/luzhou/static4/saoma.png'
src: '/static/images/SMRK/bar.png'
},
// {
// name: '',
// type: 3,
// // src: 'https://lihai001.oss-cn-chengdu.aliyuncs.com/public/kk/luzhou/static4/saoma.png'
// src: '/static/images/SMRK/img.png'
// }
],
shadowStyle: {
backgroundImage: "none",
paddingTop: "0",
marginTop: "0",
},
defaultImageSRC: 'https://lihai001.oss-cn-chengdu.aliyuncs.com/uploads/20230130/00ebcfdf75684f5494c0193075055d1.png',
product_id: '',
editGoodsCode: '',
editGoodsName: '',
@ -114,39 +230,43 @@
mer_id: 0,
searchGoodsShow: false,
searchGoodsName: '',
showModel: false,
goods: [
// {
// "id": 5,
// "store_name": "260 170X118X2605",
// "bar_code": "6940074914381",
// "unit_name": "",
// "id": 56,
// "store_name": "400 400g",
// "bar_code": "8998389621348",
// "manu_address": null,
// "price": "0.00",
// "cost": "0.00",
// "ot_price": "0.00",
// "stock": 9999999,
// "image": "127.0.0.1:8324/uploads/img/2023-11-01/1698809432.jpg"
// }
// "image": "http://lihai001.oss-cn-chengdu.aliyuncs.com/def/2023-11-02/202311021119037679.jpg",
// "slider_image": [
// "http://lihai001.oss-cn-chengdu.aliyuncs.com/def/2023-11-02/202311021119037679.jpg"
// ],
// "spec": null,
// "trademark": null,
// "manu_name": null,
// "note": null
// },
],
putGoods: {
id: '',
price: '',
stock: '',
images: [],
},
showPutGoodsInput: {
spec: false,
trademark: false,
store_name: false
},
item: [],
addGoodsShow: false,
stype: '',
}
},
onLoad(e) {
this.mer_id = e.mer_id
// this.stype = e.stype
this.stype = 2
// if (this.stype == 1) {
// return this.goodsData[0].name = ''
// }
// if (this.stype == 2) {
// return this.goodsData[0].name = ''
// }
},
onShow() {
@ -156,17 +276,60 @@
this.putGoods.id = item.id;
this.putGoods.price = '';
this.putGoods.stock = '';
Object.keys(this.showPutGoodsInput).forEach((key)=>{
if(item[key]==null||item[key]==undefined||item[key]==''){
this.showPutGoodsInput[key] = true;
this.putGoods[key] = '';
}
else {
this.showPutGoodsInput[key]=false;
this.putGoods[key] = item[key];
}
})
this.addGoodsShow = true
this.item = item
},
//
addGoodsopen() {
if (this.putGoods.id) {
console.log('开始');
micro_product_import(this.putGoods).then(e => {
let good = this.goods.find(item=>item.id==this.putGoods.id);
// console.log(good);
if (this.putGoods.id&&good) {
//
let auditFlag = false;
Object.keys(this.showPutGoodsInput).forEach((key)=>{
if(this.showPutGoodsInput[key]){
auditFlag = true;
}
})
if(auditFlag){
let obj = Object.assign({}, good, this.putGoods);
obj.product_library_id = obj.id;
obj.slider_image = obj.slider_image.join(',')
// ,
microProductAdd(obj).then(e => {
console.log(e);
if (e.status == 200) {
Toast(e.message)
this.goods = this.goods.filter(item => {
return item.id != this.putGoods.id
})
this.addGoodsShow = false;
} else {
Toast(e.message)
this.addGoodsShow = false
}
}).catch(err => {
Toast(err || '导入出错');
console.log('导入出错', err);
this.addGoodsShow = false;
});
}
else micro_product_import(this.putGoods).then(e => {
console.log('导入错误', e);
if (e.status == 200) {
Toast(e.data.msg)
this.goods = this.goods.filter(item=>{
this.goods = this.goods.filter(item => {
return item.id != this.putGoods.id
})
this.addGoodsShow = false;
@ -176,14 +339,9 @@
this.addGoodsShow = false
}
}).catch(err => {
// console.log(err);
if (err == "已经导入过该商品了") {
Toast('已经导入过该商品了')
Toast(err || '导入出错');
console.log('导入出错', err);
this.addGoodsShow = false
} else {
Toast('导入出错')
this.addGoodsShow = false
}
})
}
this.item = []
@ -193,13 +351,19 @@
},
openSearch() {},
async searchGoodsClose() {
if(this.searchGoodsName=='') {
if (this.searchGoodsName == '') {
this.searchGoodsShow = false
this.$nextTick(()=>{
this.$nextTick(() => {
Toast('请输入商品名称')
})
return ;
return;
}
this.searchGoodsShow = false
await this.$nextTick();
uni.showLoading({
title: '加载中',
mask: true
})
const rq = {
mer_id: this.mer_id,
name: this.searchGoodsName
@ -207,6 +371,7 @@
const {
data
} = await seachBarCodeAPI(rq).catch(err => Toast(err))
uni.hideLoading()
if (data.list.length < 1) {
this.searchGoodsShow = false
Toast("暂无搜索商品,请添加!")
@ -218,7 +383,6 @@
return
}
this.goods = data.list
this.searchGoodsShow = false
},
async editGoodsClose() {
const data = {
@ -237,31 +401,24 @@
},
navigato(type) {
if (type === 1) {
if (this.stype == 1) {
uni.navigateTo({
url: `/pages/product/addGoods/index?mer_id=${this.mer_id}`
});
return;
}
this.searchGoodsName = '';
this.searchGoodsShow = true
} else {
this.searchGoodsShow = true;
this.pageType = 1;
} else if(type==2) {
this.scanCode();
this.pageType = 1;
}else {
this.photograph();
this.pageType = 2;
}
},
//
scanCode() {
const self = this
uni.scanCode({
scanType: ["qrCode", "barCode", "datamatrix", "pdf417"],
success(res) {
if (self.stype == 1) {
uni.navigateTo({
url: `/pages/product/addGoods/index?mer_id=${self.mer_id}&code=${res.result}`
})
} else {
self.seachBarCode(res.result)
}
},
fail(res) {
// console.log(res);
@ -269,12 +426,20 @@
})
},
async seachBarCode(code) {
if(code.length<12){
return Toast('条形码长度不正确, 请重试!')
}
uni.showLoading({
title: '加载中',
mask: true
})
console.log('扫码的值', code);
await seachBarCodeAPI({
code: code,
mer_id: this.mer_id
}).then(res => {
console.log(res);
uni.hideLoading()
if (!res.data) {
uni.showToast({
title: res.message,
@ -288,14 +453,32 @@
})
return
}
this.goods = res.data.list
this.goods = JSON.parse(JSON.stringify(res.data.list));
// if (res.data.list[0] && res.data.list[0].store_name == '') {
// this.goods = [];
// Toast('')
// } else this.goods = JSON.parse(JSON.stringify(res.data.list));
}
}).catch((err)=>{
console.log('错误',err);
}).catch((err) => {
console.log('错误', err);
Toast('加载出错')
})
},
//
photograph(){
uni.chooseImage({
count: 1,
crop:{
width: 1024,
height: 1024,
resize: false
},
success: (res) => {
console.log(res.tempFilePaths[0]);
}
})
}
},
onPullDownRefresh() {
uni.stopPullDownRefresh()
@ -338,21 +521,38 @@
}
.select_item {
width: 336.84rpx;
// width: 220.84rpx;
width: 336rpx;
height: 189.47rpx;
border-radius: 8px;
background-color: #eee;
padding: 35.09rpx 28.07rpx;
padding: 22rpx 0;
display: flex;
flex-direction: column;
justify-content: space-between;
color: #fff;
background-size: cover;
background-repeat: no-repeat;
align-items: center;
.title {
font-size: 35.09rpx;
font-size: 32.09rpx;
}
.img{
width: 90rpx;
height: 90rpx;
}
}
.select_item1{
background: linear-gradient(to right, #ffba00, #ff9000) !important;
}
.select_item2{
background: linear-gradient(to right, #459eff, #0a60ff) !important;
}
.select_item3{
background: linear-gradient(to right, #ff7245, #ff3f02) !important;
}
.search_goods_box {
@ -539,6 +739,29 @@
display: flex;
flex-direction: column;
.center {
display: flex;
align-items: flex-end;
.tip {
padding: 5rpx 10rpx;
background-color: #f84221;
color: #fff;
font-size: 20rpx;
border-radius: 10rpx;
margin-left: 12rpx;
}
.tip_green {
padding: 5rpx 10rpx;
background-color: #f84221;
color: #fff;
font-size: 20rpx;
border-radius: 10rpx;
margin-left: 12rpx;
}
}
.add-btn {
align-self: flex-end;
text-align: center;
@ -610,6 +833,8 @@
}
}
.merchant_info {
display: flex;
align-items: center;
@ -797,4 +1022,127 @@
}
}
}
.list-box-put {
.item {
width: 694rpx;
margin: 0 auto;
margin-top: 20rpx;
background-color: #fff;
border-radius: 14rpx;
.top {
display: flex;
padding: 22rpx;
.pictrue {
margin-right: 16rpx;
.img {
width: 200rpx;
height: 200rpx;
}
.swiper {
width: 100%;
display: flex;
justify-content: space-between;
image {
width: 60rpx;
height: 60rpx;
}
}
}
.text-info {
flex: 1;
.title {
display: flex;
.text_item_title {
flex-shrink: 0;
margin-right: 10rpx;
}
}
.text {
display: flex;
justify-content: space-between;
font-size: 24rpx;
padding-right: 10rpx;
padding-top: 10rpx;
.text_item {
flex: 1;
display: flex;
.text_item_title {
flex-shrink: 0;
margin-right: 10rpx;
}
.more {
// font-size: 24rpx;
flex: 1;
// height: auto;
}
}
}
}
}
.bottom {
display: flex;
justify-content: space-between;
padding: 16rpx 22rpx;
.add-btn {
background-color: #419aff;
color: #fff;
height: 50rpx;
width: 160rpx;
line-height: 50rpx;
text-align: center;
border-radius: 50rpx;
}
}
}
}
.photo-box{
.card{
width: 694rpx;
margin: 0 auto;
margin-top: 20rpx;
background-color: #fff;
padding: 20rpx;
border-radius: 14rpx;
.card-head{
display: flex;
justify-content: space-between;
margin-bottom: 20rpx;
}
.img-list{
display: flex;
flex-wrap: wrap;
justify-content: space-between;
align-items: center;
.img{
width: 210rpx;
height: 210rpx;
margin-bottom: 15rpx;
border-radius: 14rpx;
overflow: hidden;
}
}
.img-list2{
justify-content: left;
.img{
margin-right: 16rpx;
}
}
}
}
</style>

View File

@ -513,7 +513,13 @@
//
this.brand = (await categoryBrandlist(this.merId)).data;
//
this.platformClassificationData = (await categoryList(this.merId)).data;
let { data } = await categoryList(this.merId);
data.forEach((item1)=>{
item1.children.forEach((item2)=>{
item2.children = null;
})
})
this.platformClassificationData = data;
//
},
//

View File

@ -716,13 +716,6 @@
// this.getAgreement();
let _this = this
this.textareaStatus = true;
if (this.isLogin && this.toPay == false && !this.orderPay) {
this.getaddressInfo();
this.$nextTick(function() {
this.$refs.addressWindow.getAddressList();
this.getUserInfo()
})
}
uni.setStorage({
key: 'invoice_Data',
data: {},
@ -742,6 +735,13 @@
uni.$off('handClick');
})
that.invoice.invoice = false
if (this.isLogin && this.toPay == false && !this.orderPay) {
this.getaddressInfo();
this.$nextTick(function() {
this.$refs.addressWindow.getAddressList();
this.getUserInfo()
})
}
},
/**
* 生命周期函数--监听页面隐藏
@ -1187,11 +1187,15 @@
if (that.addressInfo.real_name) {
that.textareaStatus = false;
that.address.address = true;
that.pagesUrl = '/pages/users/user_address/index?cartId=' + this.cartId + '&pinkId=' + this
.pinkId + '&couponId=' + this.couponId;
// that.pagesUrl = '/pages/users/user_address/index?cartId=' + this.cartId + '&pinkId=' + this
// .pinkId + '&couponId=' + this.couponId;
that.pagesUrl = '/pages/users/user_address_list/index'
} else {
// uni.navigateTo({
// url: `/pages/users/user_address/index?cartId=${this.cartId}`,
// });
uni.navigateTo({
url: `/pages/users/user_address/index?cartId=${this.cartId}`,
url: `pages/users/user_address_list/index`,
});
}
},