Merge branch 'main' into prod

This commit is contained in:
weipengfei 2023-11-04 17:47:13 +08:00
commit 233a0748a2
6 changed files with 273 additions and 68 deletions

View File

@ -16,6 +16,14 @@ export function microProductAdd(data) {
return request.post('micro/product_add', data); return request.post('micro/product_add', data);
} }
/**
* 添加商品库审核
*
*/
export function microProductEdit(data) {
return request.post('micro/eadt_product', data);
}
/** /**
* 获取收款二维码 * 获取收款二维码
* @returns {*} * @returns {*}

View File

@ -47,7 +47,7 @@
</view> </view>
<view class="pos-order-goods" v-for="(val, key) in item.refundProduct" :key="key" <view class="pos-order-goods" v-for="(val, key) in item.refundProduct" :key="key"
@click="toRefundDetail(item)"> @click="toRefundDetail(item)">
<view class="goods acea-row row-between-wrapper"> <view v-if="val.product" class="goods acea-row row-between-wrapper">
<view class="picTxt acea-row row-between-wrapper"> <view class="picTxt acea-row row-between-wrapper">
<view class="pictrue"> <view class="pictrue">
<image :src="val.product.cart_info.product.image" /> <image :src="val.product.cart_info.product.image" />

View File

@ -13,7 +13,7 @@
<text>{{merchant_Data.unpaid_margin}}</text> <text>{{merchant_Data.unpaid_margin}}</text>
</view> </view>
<view class="item"> <view class="item">
<text>缴纳店铺账户</text> <text>缴纳押金账户</text>
<text>{{merchant_Data.mer_name}}</text> <text>{{merchant_Data.mer_name}}</text>
</view> </view>
</view> </view>

View File

@ -14,12 +14,13 @@
<view class="top"> <view class="top">
<view class="pictrue"> <view class="pictrue">
<!-- <easy-loadimage mode="widthFix" :image-src="item.image"></easy-loadimage> --> <!-- <easy-loadimage mode="widthFix" :image-src="item.image"></easy-loadimage> -->
<image class="img" :src="item.image||defaultImageSRC" :lazy-load="true"></image> <image class="img" :src="item.image||defaultImageSRC" :lazy-load="true" @click="clickImg(item, 1, 0)"></image>
<view class="swiper"> <view class="swiper">
<image :src="item.slider_image[0]||defaultImageSRC" :lazy-load="true"></image> <image :src="item.slider_image[0]||defaultImageSRC" :lazy-load="true" @click="clickImg(item, 2, 0)"></image>
<image :src="item.slider_image[1]||defaultImageSRC" :lazy-load="true"></image> <image :src="item.slider_image[1]||defaultImageSRC" :lazy-load="true" @click="clickImg(item, 2, 1)"></image>
<image :src="item.slider_image[2]||defaultImageSRC" :lazy-load="true"></image> <image :src="item.slider_image[2]||defaultImageSRC" :lazy-load="true" @click="clickImg(item, 2, 2)"></image>
</view> </view>
<view v-if="item.update" class="btn" @click="updateItemImage(item)">保存修改</view>
</view> </view>
<view class="text-info"> <view class="text-info">
<view class="title"> <view class="title">
@ -135,7 +136,7 @@
<u-popup :show="addGoodsShow" @close="searchGoodsClose" :round="18" mode="center"> <u-popup :show="addGoodsShow" @close="searchGoodsClose" :round="18" mode="center">
<view class="search_goods_box"> <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="display: flex;align-items: center;margin-top: 16rpx;">
<view style="margin-right: 20rpx;">名称:</view> <view style="margin-right: 20rpx;">名称:</view>
<input style="flex: 1;" type="text" v-model="putGoods.store_name" class="putGoods" placeholder="请输入商品名称"> <input style="flex: 1;" type="text" v-model="putGoods.store_name" class="putGoods" placeholder="请输入商品名称">
</view> </view>
@ -157,7 +158,7 @@
</view> </view>
<view class="search_goods_btn"> <view class="search_goods_btn">
<view class="cancel edit_btn" @click="addGoodsclose()">取消</view> <view class="cancel edit_btn" @click="addGoodsclose()">取消</view>
<view class="search edit_btn" @click="addGoodsopen()">确定</view> <view class="search edit_btn" @click="$u.throttle(addGoodsopen, 1500)">确定</view>
</view> </view>
</view> </view>
</u-popup> </u-popup>
@ -170,26 +171,34 @@
</view> </view>
</view> </view>
</u-popup> </u-popup>
<u-modal :show="showModel" title="提示" content="没有找到该商品,是否添加?"></u-modal> <u-modal :show="showModel" title="提示" content="没有找到该商品,是否手动添加?" show-cancel-button @cancel="showModel = false" @confirm="navToAdd"></u-modal>
</view> </view>
</template> </template>
<script> <script>
import {
TOKENNAME,
HTTP_REQUEST_URL
} from '@/config/app.js';
import { import {
productCreate productCreate
} from '@/api/product.js' } from '@/api/product.js'
import { import {
microSeachBarCode, microSeachBarCode,
microEadtProduct, microEadtProduct,
microProductAdd microProductAdd,
microProductEdit
} from '@/api/store.js' } from '@/api/store.js'
import { import {
seachBarCodeAPI, seachBarCodeAPI,
micro_product_import micro_product_import
} from '@/api/api.js' } from '@/api/api.js'
import { import {
Toast chooseImage,
Toast,
getStorage,
navigateTo
} from '@/libs/uniApi' } from '@/libs/uniApi'
export default { export default {
data() { data() {
@ -208,12 +217,12 @@
// 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' src: '/static/images/SMRK/bar.png'
}, },
// { {
// name: '', name: '非标手动入库',
// type: 3, type: 3,
// // 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/img.png' src: '/static/images/SMRK/img.png'
// } }
], ],
shadowStyle: { shadowStyle: {
backgroundImage: "none", backgroundImage: "none",
@ -231,35 +240,40 @@
searchGoodsShow: false, searchGoodsShow: false,
searchGoodsName: '', searchGoodsName: '',
showModel: false, showModel: false,
showModelCode: '',
goods: [ goods: [
// { // {
// "id": 56, // "id": 35,
// "store_name": "400 400g", // "store_name": "DT1515015024",
// "bar_code": "8998389621348", // "bar_code": "6903244675314",
// "manu_address": null, // "manu_address": "",
// "price": "0.00", // "price": "0.00",
// "stock": 9999999, // "stock": 9999999,
// "image": "http://lihai001.oss-cn-chengdu.aliyuncs.com/def/2023-11-02/202311021119037679.jpg", // "image": "https://lihai001.oss-cn-chengdu.aliyuncs.com/uploads/20230130/00ebcfdf75684f5494c0193075055d1.png",
// "slider_image": [ // "slider_image": [],
// "http://lihai001.oss-cn-chengdu.aliyuncs.com/def/2023-11-02/202311021119037679.jpg" // "spec": "1",
// ], // "trademark": "",
// "spec": null, // "manu_name": null,
// "trademark": null, // "note": ""
// "manu_name": null,
// "note": null
// }, // },
], ],
putGoods: { putGoods: { //
id: '', id: '',
price: '', price: '',
stock: '', stock: '',
store_name: '',
images: [], images: [],
}, },
uploadImgInfo:{ //
id: '',
type: 1,
index: 0
},
uploadImgIdList: new Map(),//,
showPutGoodsInput: { showPutGoodsInput: {
spec: false, spec: false,
trademark: false, trademark: false,
store_name: false
}, },
item: [], item: [],
addGoodsShow: false, addGoodsShow: false,
@ -273,9 +287,15 @@
}, },
methods: { methods: {
addGoods(item) { addGoods(item) {
if(this.isNullImage(item.image)||
( this.isNullImage(item.slider_image[0]) && this.isNullImage(item.slider_image[1]) && this.isNullImage(item.slider_image[2]) )){
return Toast('请先上传商品图片后再加入店铺');
}
if(item.update) return Toast('请保存修改后再添加');
this.putGoods.id = item.id; this.putGoods.id = item.id;
this.putGoods.price = ''; this.putGoods.price = '';
this.putGoods.stock = ''; this.putGoods.stock = '';
this.putGoods.store_name = item.store_name;
Object.keys(this.showPutGoodsInput).forEach((key)=>{ Object.keys(this.showPutGoodsInput).forEach((key)=>{
if(item[key]==null||item[key]==undefined||item[key]==''){ if(item[key]==null||item[key]==undefined||item[key]==''){
this.showPutGoodsInput[key] = true; this.showPutGoodsInput[key] = true;
@ -290,10 +310,135 @@
this.addGoodsShow = true this.addGoodsShow = true
this.item = item this.item = item
}, },
isNullImage(src){
let flag = false;
if(src==this.defaultImageSRC||!src)flag =true;
return flag;
},
clickImg(data, type, index){
if(!data.update&&!this.uploadImgIdList.get(data.id)){
let arr = [];
if(this.isNullImage(data.image))arr.push(-1);
if(this.isNullImage(data.slider_image[0]))arr.push(0);
if(this.isNullImage(data.slider_image[1]))arr.push(1);
if(this.isNullImage(data.slider_image[2]))arr.push(2);
this.uploadImgIdList.set(data.id, arr)
}
let obj = this.uploadImgIdList.get(data.id) || [];
if(type==1&&!obj.includes(-1)) return ;
if(type==2&&!obj.includes(index)) return ;
this.uploadImgInfo.id = data.id;
this.uploadImgInfo.type = type;
this.uploadImgInfo.index = index;
if(data.image==this.defaultImageSRC||(type==2&&this.isNullImage(data.slider_image[index]))){
this.chooseImg()
}else if(data.update){
this.chooseImg()
}
},
chooseImg(){
let that = this;
uni.chooseImage({
count: 1,
sizeType: ['original'],
crop:{
width: 1024,
height: 1024,
resize: false
},
success: (res) => {
let tempFilePaths = res.tempFilePaths[0]
//#ifdef APP-PLUS
if (uni.getSystemInfoSync().platform == 'ios') {
that.doUpload(tempFilePaths)
} else {
let size = res.tempFiles[0].size / 1024
if (size >= 1) {
uni.compressImage({
src: tempFilePaths,
quality: 80, // jpg
success: res => {
that.doUpload(res.tempFilePath)
},
fail: err => {
that.doUpload(tempFilePaths)
}
})
} else {
that.doUpload(tempFilePaths)
}
}
//#endif
//#ifndef APP-PLUS
that.doUpload(tempFilePaths)
//#endif
}
})
},
doUpload(rsp) {
let that = this
uni.showLoading({
title: '上传中',
mask: true
})
uni.uploadFile({
url: HTTP_REQUEST_URL + '/api/upload/image/field',
filePath: rsp,
name: 'field',
header: {
// #ifdef MP
"Content-Type": "multipart/form-data",
// #endif
[TOKENNAME]: 'Bearer ' + that.$store.state.app.token
},
success: (uploadFileRes) => {
let imgData = JSON.parse(uploadFileRes.data)
if(this.uploadImgInfo.type==1){
this.goods.forEach(item=>{
if(item.id==this.uploadImgInfo.id){
item.image = imgData.data.path;
item.update = true;
}
})
this.putGoods.image = imgData.data.path;
}else if(this.uploadImgInfo.type==2){
this.goods = this.goods.map(item=>{
if(item.id==this.uploadImgInfo.id){
item.slider_image[this.uploadImgInfo.index] = imgData.data.path;
item.update = true;
}
return item;
})
this.putGoods.slider_image[this.uploadImgInfo.index] = imgData.data.path;
}
},
complete(res) {
let data = JSON.parse(res.data)
that.$util.Tips({
title: data.message
});
}
});
},
//
updateItemImage(item){
microProductEdit({
id: item.id,
image: item.image,
slider_image: item.slider_image.join(',')
}).then((res)=>{
this.goods = this.goods.map(e=>{
if(e.id==item.id)e.update = false;
return e;
})
Toast('更新成功')
}).catch(err=>{
Toast(err||'更新失败')
})
},
// //
addGoodsopen() { async addGoodsopen() {
let good = this.goods.find(item=>item.id==this.putGoods.id); let good = this.goods.find(item=>item.id==this.putGoods.id);
// console.log(good);
if (this.putGoods.id&&good) { if (this.putGoods.id&&good) {
// //
let auditFlag = false; let auditFlag = false;
@ -317,7 +462,7 @@
this.addGoodsShow = false; this.addGoodsShow = false;
} else { } else {
Toast(e.message) Toast(e.message)
this.addGoodsShow = false this.addGoodsShow = false;
} }
}).catch(err => { }).catch(err => {
Toast(err || '导入出错'); Toast(err || '导入出错');
@ -408,8 +553,9 @@
this.scanCode(); this.scanCode();
this.pageType = 1; this.pageType = 1;
}else { }else {
this.photograph(); // this.photograph();
this.pageType = 2; // this.pageType = 2;
this.jumpAddGoods();
} }
}, },
// //
@ -425,15 +571,27 @@
}, },
}) })
}, },
isStartsWith6Or06(str) {
const regex = /^(6|06)/;
return regex.test(str);
},
async seachBarCode(code) { async seachBarCode(code) {
if(code.length<12){ if(code.length<12){
return Toast('条形码长度不正确, 请重试!') return Toast('条形码长度不正确, 请重试!')
} }
this.showModelCode = code;
console.log('扫码的值', code);
if(!this.isStartsWith6Or06(code)) {
Toast('暂不支持进口商品!');
this.$u.sleep(1200).then(()=>{
this.showModel = true;
})
return ;
}
uni.showLoading({ uni.showLoading({
title: '加载中', title: '加载中',
mask: true mask: true
}) })
console.log('扫码的值', code);
await seachBarCodeAPI({ await seachBarCodeAPI({
code: code, code: code,
mer_id: this.mer_id mer_id: this.mer_id
@ -448,9 +606,7 @@
}); });
} else { } else {
if (res.data.list.length < 1) { if (res.data.list.length < 1) {
uni.navigateTo({ this.showModel = true;
url: `/pages/product/addGoods/index?mer_id=${this.mer_id}&code=${code}`
})
return return
} }
this.goods = JSON.parse(JSON.stringify(res.data.list)); this.goods = JSON.parse(JSON.stringify(res.data.list));
@ -461,7 +617,10 @@
} }
}).catch((err) => { }).catch((err) => {
console.log('错误', err); console.log('错误', err);
Toast('加载出错') Toast(err);
this.$u.sleep(1200).then(()=>{
this.showModel = true;
})
}) })
}, },
@ -478,7 +637,34 @@
console.log(res.tempFilePaths[0]); console.log(res.tempFilePaths[0]);
} }
}) })
} },
navToAdd(){
let url;
if(this.showModelCode) url = `/pages/product/addGoods/index?mer_id=${this.mer_id}&code=${this.showModelCode}`;
else url = `/pages/product/addGoods/index?mer_id=${this.mer_id}`;
uni.navigateTo({
url:url,
success:()=> {
this.showModel = false;
}
})
},
//
jumpAddGoods() {
const data = getStorage('addGoodsFormData');
if (data && data.product_id) {
let waitDeleteData = ['addGoodsFormData', 'singleSpecification', 'attrValue', 'modifyPriceData',
'addGoodsSecoundData', 'goodsDis', 'editGoodsDetils'];
waitDeleteData.forEach(item => {
if (getStorage(item)) {
removeStorage(item);
}
})
}
navigateTo(1, '/pages/product/addGoods/index', {
mer_id: this.mer_id
});
},
}, },
onPullDownRefresh() { onPullDownRefresh() {
uni.stopPullDownRefresh() uni.stopPullDownRefresh()
@ -521,8 +707,8 @@
} }
.select_item { .select_item {
// width: 220.84rpx; width: 220.84rpx;
width: 336rpx; // width: 336rpx;
height: 189.47rpx; height: 189.47rpx;
border-radius: 8px; border-radius: 8px;
background-color: #eee; background-color: #eee;
@ -1053,6 +1239,18 @@
height: 60rpx; height: 60rpx;
} }
} }
.btn{
font-size: 24rpx;
margin: 0 auto;
margin-top: 10rpx;
width: 120rpx;
height: 40rpx;
background-color: #419aff;
color: #fff;
line-height: 40rpx;
text-align: center;
border-radius: 40rpx;
}
} }
.text-info { .text-info {

View File

@ -41,6 +41,11 @@
<image src="@/static/images/guanbi.png" class="guanbi" @click="close"></image> <image src="@/static/images/guanbi.png" class="guanbi" @click="close"></image>
</u-popup> </u-popup>
</view> </view>
<commodityComponent v-if="showCommodity" :key="showCommodity" :showCommodity="showCommodity" :resetKey="secoundModel" :product_id="product_id" :merId="merId"
:code="code" @lastStep="lastStep">
</commodityComponent>
<view class="popup_group"> <view class="popup_group">
<view class="popup_group_item" @click="selectPlatform"> <view class="popup_group_item" @click="selectPlatform">
@ -165,10 +170,6 @@
</view> --> </view> -->
</view> </view>
<commodityComponent v-if="showCommodity" :key="showCommodity" :showCommodity="showCommodity" :resetKey="secoundModel" :product_id="product_id" :merId="merId"
:code="code" @lastStep="lastStep">
</commodityComponent>
<view class="popup_group"> <view class="popup_group">
<!-- <view class="popup_group_item" @click="showMoreInfo=!showMoreInfo"> <!-- <view class="popup_group_item" @click="showMoreInfo=!showMoreInfo">
<view class="popup_group_item_label">更多信息</view> <view class="popup_group_item_label">更多信息</view>

View File

@ -9,11 +9,11 @@
<block> <block>
<swiper-item :class="{ active: 0 == swiperCur }"> <swiper-item :class="{ active: 0 == swiperCur }">
<view class="slide-navigator"> <view class="slide-navigator">
<view class="item" hover-class='none' @click="jumpAddGoods"> <!-- <view class="item" hover-class='none' @click="jumpAddGoods">
<image mode='widthFix' class="image" src="../static/images/product_add.png"> <image mode='widthFix' class="image" src="../static/images/product_add.png">
</image> </image>
<text class="text">添加商品</text> <text class="text">添加商品</text>
</view> </view> -->
<navigator class="item" <navigator class="item"
:url="`/pages/product/goodsOnSale/index?mer_id=${mer_id}&type=1`" :url="`/pages/product/goodsOnSale/index?mer_id=${mer_id}&type=1`"
hover-class='none'> hover-class='none'>
@ -21,7 +21,7 @@
</image> </image>
<text class="text">在售商品</text> <text class="text">在售商品</text>
</navigator> </navigator>
<navigator class="item" <!-- <navigator class="item"
:url="`/pages/product/goodsOnSale/index?mer_id=${mer_id}&type=3`" :url="`/pages/product/goodsOnSale/index?mer_id=${mer_id}&type=3`"
hover-class='none'> hover-class='none'>
<image mode='widthFix' class="image" src="../static/images/product_out.png"> <image mode='widthFix' class="image" src="../static/images/product_out.png">
@ -34,7 +34,7 @@
<image mode='widthFix' class="image" src="../static/images/product_recycle.png"> <image mode='widthFix' class="image" src="../static/images/product_recycle.png">
</image> </image>
<text class="text">回收站</text> <text class="text">回收站</text>
</navigator> </navigator> -->
<navigator class="item" <navigator class="item"
:url="`/pages/product/storeClassification/index?mer_id=${mer_id}`" :url="`/pages/product/storeClassification/index?mer_id=${mer_id}`"
hover-class='none'> hover-class='none'>
@ -42,11 +42,6 @@
</image> </image>
<text class="text">店铺分类</text> <text class="text">店铺分类</text>
</navigator> </navigator>
</view>
</swiper-item>
<swiper-item :class="{ active: 1 == swiperCur }">
<view class="slide-navigator">
<!-- 隐藏暂时不需要 -->
<navigator class="item" <navigator class="item"
:url="`/pages/product/addGoods/freightTemplate?mer_id=${mer_id}`" :url="`/pages/product/addGoods/freightTemplate?mer_id=${mer_id}`"
hover-class='none'> hover-class='none'>
@ -54,13 +49,6 @@
</image> </image>
<text class="text">运费模板</text> <text class="text">运费模板</text>
</navigator> </navigator>
<navigator class="item"
:url="`/pages/product/addGoods/mulSpecification?mer_id=${mer_id}`"
hover-class='none'>
<image mode='widthFix' class="image"
src="../static/images/product_specification.png"></image>
<text class="text">规格模板</text>
</navigator>
<navigator class="item" <navigator class="item"
:url="`/pages/users/online_warehousing/index?mer_id=${mer_id}&product_id=${data.product_id}&unique=${data.unique}&type=${mer_info.type_code}`" :url="`/pages/users/online_warehousing/index?mer_id=${mer_id}&product_id=${data.product_id}&unique=${data.unique}&type=${mer_info.type_code}`"
hover-class='none'> hover-class='none'>
@ -69,6 +57,17 @@
</navigator> </navigator>
</view> </view>
</swiper-item> </swiper-item>
<!-- <swiper-item :class="{ active: 1 == swiperCur }">
<view class="slide-navigator">
<navigator class="item"
:url="`/pages/product/addGoods/mulSpecification?mer_id=${mer_id}`"
hover-class='none'>
<image mode='widthFix' class="image"
src="../static/images/product_specification.png"></image>
<text class="text">规格模板</text>
</navigator>
</view>
</swiper-item> -->
</block> </block>
</swiper> </swiper>
</div> </div>
@ -482,8 +481,7 @@
const data = getStorage('addGoodsFormData'); const data = getStorage('addGoodsFormData');
if (data && data.product_id) { if (data && data.product_id) {
let waitDeleteData = ['addGoodsFormData', 'singleSpecification', 'attrValue', 'modifyPriceData', let waitDeleteData = ['addGoodsFormData', 'singleSpecification', 'attrValue', 'modifyPriceData',
'addGoodsSecoundData', 'goodsDis', 'editGoodsDetils' 'addGoodsSecoundData', 'goodsDis', 'editGoodsDetils'];
];
waitDeleteData.forEach(item => { waitDeleteData.forEach(item => {
if (getStorage(item)) { if (getStorage(item)) {
removeStorage(item); removeStorage(item);