Browse Source

修改认证接口修改,上传商品优化

master
杨豪 3 years ago
parent
commit
28e2bc7e92
  1. 7
      App.vue
  2. 342
      pages/life/addGoods/index.vue
  3. 7
      pages/life/index.vue
  4. 1
      pages/release/companyAuth/index.vue
  5. 58
      pages/release/perfectPersonInfo/index.vue
  6. 19
      pages/release/personAuth/index.vue
  7. 5
      pages/user/goodsManage/index.vue
  8. BIN
      static/images/batch-icon.png

7
App.vue

@ -27,9 +27,8 @@ export default {
},
onShow(e) {
this.globalData.scene = e.scene
console.log(this.globalData.scene,'this.globalData.scene')
// console.log(this.globalData.scene,'this.globalData.scene')
//tabbar
uni.hideTabBar();
var query = {};
@ -47,12 +46,12 @@ export default {
query = JSON.parse("{" + urlSpread + "}");
}
console.log('query1', query);
// console.log('query1', query);
this.globalData.inviterId = query.id;
}
} else {
query = e.query;
console.log('query2', query);
// console.log('query2', query);
this.globalData.inviterId = query.id;
}
},

342
pages/life/addGoods/index.vue

@ -40,37 +40,6 @@
</view>
</view>
</view>
<!-- <view class="title2" @click="addSku">添加规格</view> -->
<!-- <view class="add-sku-box">
<view class="sku-item" v-for="(item,index) in attrs" :key="index">
<view class="close-btn" @click="delSku(index)">×</view>
<view class="sku img-sku acea-row row-middle row-between">
<text>图片</text>
<image src="../../../static/images/upload.png" v-if="item.pic == ''" @tap="uploadSkuImg(index)"></image>
<image :src="item.pic" v-else @tap="uploadSkuImg(index)" mode="aspectFill"></image>
</view>
<view class="sku img-sku acea-row row-middle row-between">
<text>价格<text class="colR">*</text></text>
<input type="number" v-model="item.price" placeholder="请输入售价(元)" />
</view>
<view class="sku img-sku acea-row row-middle row-between">
<text>市场价格</text>
<input type="number" v-model="item.ot_orice" placeholder="请输入市场价格(元)" />
</view>
<view class="sku img-sku acea-row row-middle row-between">
<text>库存<text class="colR">*</text></text>
<input type="number" v-model="item.stock" placeholder="请输入库存" />
</view>
<view class="sku img-sku acea-row row-middle row-between">
<text>重量</text>
<input type="number" v-model="item.weight" placeholder="请输入重量kg" />
</view>
<view class="sku img-sku acea-row row-middle row-between">
<text>体积</text>
<input type="number" v-model="item.volume" placeholder="请输入体积m³" />
</view>
</view>
</view> -->
<!-- // -->
<view class="set-title">规格设置</view>
<view class="setattr-box">
@ -86,32 +55,29 @@
<view class="del-attr" @tap.stop="delAttr(index)">×</view>
</view>
</view>
<!-- 规格设置 -->
<view class="add-sku-box">
<view class="sku-item">
<view class="sku img-sku acea-row row-middle row-between">
<text>价格<text class="colR">*</text></text>
<input type="number" v-model="attrs[0].price" @input="changePrice" placeholder="请输入售价(元)" />
</view>
<view class="sku img-sku acea-row row-middle row-between">
<text>库存<text class="colR">*</text></text>
<input type="number" v-model="attrs[0].stock" @input="changeStock" placeholder="请输入库存" />
</view>
</view>
</view>
<!-- 批量操作 -->
<view class="batch-set-box" v-if="batchData.titleStr != ''">
<view class="box-top acea-row row-between-wrapper">
<view class="name">{{batchData.titleStr}}</view>
<view class="attr-name w15">库存</view>
<view class="attr-name w15">价格</view>
<view class="acea-row row-middle batch" @click="setAttrVal(0,1)">
<image src="../../../static/images/batch-icon.png"></image>
<text>批量修改</text>
</view>
</view>
<block v-for="(i,idx) in batchData.priceArr" :key="idx">
<view class="box-b acea-row row-between-wrapper">
<!-- <view class="name line1">{{i.sku.replace(/,/, '/')}}</view> -->
<view class="box-b acea-row row-between-wrapper" @click="setAttrVal(idx,0)">
<view class="box-b-l acea-row row-middle ">
<image src="../../../static/images/upload.png" class="attrImg" v-if="i.pic == ''" @tap.stop="uploadAttrImg(idx)"></image>
<image :src="i.pic" class="attrImg" mode="aspectFill" v-else @tap.stop="uploadAttrImg(idx)"></image>
<view class="name line1">{{i.sku.split(',').reverse().join('/')}}</view>
<view class="inp-box w15"><input type="number" placeholder="0" v-model="i.stock"></view>
<view class="inp-box w15"><input type="number" placeholder="0" v-model="i.price"></view>
</view>
<view class="acea-row row-middle">
<view class="box-b-r">
<view>售价{{i.price}}</view>
<view>库存{{i.stock}}</view>
</view>
<image class="arrow" src="../../../static/images/arror-r-s.png"></image>
</view>
</view>
</block>
</view>
@ -128,10 +94,10 @@
<view class="acea-row row-middle">
<radio-group @change="radioChange">
<label>
<radio :value="0" :checked="state == 0" /><text>上架</text>
<radio :value="1" :checked="isShow == 1" /><text>上架</text>
</label>
<label>
<radio :value="1" :checked="state == 1" /><text>不上架</text>
<radio :value="0" :checked="isShow == 0" /><text>不上架</text>
</label>
</radio-group>
</view>
@ -139,6 +105,26 @@
<view class="btn-box">
<view class="btn" @tap="submit">提交</view>
</view>
<!-- 设置单个属性弹框 -->
<view class="set-attr-val" :class="showAttrVal ? 'isShow' : ''">
<view class="title">{{attrValTitle}}</view>
<view class="inp-box">
<text>售价()</text>
<input type="number" placeholder="0" v-model="price">
</view>
<view class="inp-box">
<text>原价()</text>
<input type="number" placeholder="0" v-model="ot_price">
</view>
<view class="inp-box">
<text>库存</text>
<input type="number" placeholder="0" v-model="stock">
</view>
<view class="btn-box">
<view class="cancel-btn" @click="cancelClick">取消</view>
<view class="submit-btn" @click="submitClick">确定</view>
</view>
</view>
<!-- // -->
<view class="mask-box" v-if="maskShow == true">
<view class="addattr-dialog" v-if="addOptionsDialog == true">
@ -182,21 +168,55 @@
{
pic: '', //" --",
price: '', //" ",
ot_orice: '', //" --",
ot_price: '', //" --",
stock: '', //"",
weight: '', //" --",
volume: '', //" --"
}
],
price: '',
ot_price: '',
stock:'',
isShow: 0,
spec_type: 0,
items: [],
attrArr:[],
attrArr:[{
value: '规格',
detail:['默认']
}],
attr:{},
state: 0,
maskShow: false,
addOptionsDialog: false,
infinite: false,
batchData: {titleStr: '',priceArr: []},
batchData: {
titleStr: '规格',
priceArr: [
{
bar_code: "",
brokerage: 0,
brokerage_two: 0,
cost: 0,
integral: 0,
ot_price: 0,
pic: "",
pink_price: 0,
pink_stock: 0,
price: 0,
seckill_price: 0,
seckill_stock: 0,
sku: "默认",
stock: 0,
value1: "",
volume: 0,
weight: 0,
}
],
},
editattr: false,
idx: null,
showAttrVal: false,
attrValTitle: ''
}
},
@ -214,20 +234,16 @@
this.description = info.description
this.store_name = info.store_name
this.items = info.items
if(info.attrs){
this.$set(this.batchData,'priceArr',info.attrs)
this.attrArr = info.items
this.spec_type = 1
this.isShow = info.is_show
let strArr = info.items.map(item=>{
return item.value
})
console.log(strArr)
this.$set(this.batchData,'titleStr',strArr.join('/'))
} else{
this.attrs[0].price = info.price
this.attrs[0].stock = info.stock
}
this.getFormatAttr()
})
} else{
this.spec_type = 0
console.log('新增')
}
},
@ -236,8 +252,9 @@
var imgurls = []
chooseImages((imgs)=>{
imgurls.push(imgs)
})
this.slider_image = imgurls
})
},
uploadImg(idx){
chooseImage((img)=>{
@ -248,11 +265,6 @@
}
})
},
uploadSkuImg(idx){
chooseImage((img)=>{
this.$set(this.attrs,idx,{pic: img})
})
},
toGoodsDetails(){
uni.navigateTo({
url: '/pages/life/goodsDetails/index?desc='+encodeURIComponent(this.description)
@ -265,10 +277,7 @@
},
//
addAttr(){
let j = {
value: '',
detail:['']
}
let j = { value: '', detail:[''] }
this.attr = j
this.editattr = false; //attrFALSE
this.maskShow = true;
@ -364,47 +373,69 @@
let allArr = cartesianProductOf(...tmp)
return allArr
},
//
changePrice(e){
const price = e.detail.value
if(this.batchData.priceArr && this.batchData.priceArr.length > 0){
this.batchData.priceArr.forEach((item,i)=>{
item.price = price
//
uploadAttrImg(idx){
chooseImage((img)=>{
this.batchData.priceArr[idx].pic= img
})
},
//
setAttrVal(idx,type){
if(type == 0){
this.idx = idx
this.price= this.batchData.priceArr[idx].price
this.ot_price= this.batchData.priceArr[idx].ot_price
this.stock= this.batchData.priceArr[idx].stock
this.attrValTitle = this.batchData.priceArr[idx].sku.split(',').reverse().join('/')
} else{
this.attrValTitle = '批量修改规格'
}
this.attrs[0].price = price
// console.log(this.batchData.priceArr,'this.batchData.priceArr')
this.showAttrVal= true
},
changeStock(e){
const stock = e.detail.value
if(this.batchData.priceArr && this.batchData.priceArr.length > 0){
this.batchData.priceArr.forEach((item,i)=>{
item.stock = stock
cancelClick(){
this.idx = null
this.showAttrVal= false
},
submitClick(){
const idx = this.idx
console.log(this.price,this.ot_price,this.stock)
if(this.stock == 0){
return this.alertMessage('商品库存不能为0')
}
if(this.attrValTitle == '批量修改规格'){
this.batchData.priceArr.forEach((item)=>{
item.price = this.price
item.ot_price = this.ot_price
item.stock = this.stock
})
}
this.attrs[0].stock = stock
} else{
this.$set(this.batchData.priceArr[idx],'price',this.price)
this.$set(this.batchData.priceArr[idx],'ot_price',this.ot_price)
this.$set(this.batchData.priceArr[idx],'stock',this.stock)
// this.batchData.priceArr[idx].price= this.price
// this.batchData.priceArr[idx].ot_price= this.ot_price
// this.batchData.priceArr[idx].stock= this.stock
}
this.showAttrVal= false
},
radioChange(e){
this.isShow= e.detail.value
},
submit(){
// console.log(this.batchData)
var arrtsArr = []
if(this.batchData.priceArr && this.batchData.priceArr[0].price != ''){
arrtsArr = this.batchData.priceArr
} else{
arrtsArr = this.attrs
}
let form = {
store_name: this.store_name,
unit_name: this.unit_name,
image: this.slider_image[0], //
slider_image: this.slider_image , //
description: this.description, //
tempId: this.tempId, //
attrs: arrtsArr,
state: this.state,
items: this.items,
spec_type: arrtsArr.length > 1 ? 1 : 0 //
temp_id: this.tempId, //
attrs: this.batchData.priceArr,
isShow: this.isShow,
items: this.items
}
console.log(form)
if(form.store_name == ''){
this.alertMessage('请填写商品名称')
return
@ -419,16 +450,18 @@
return
}
form.attrs.forEach((item,index)=>{
if(item.price == ''){
if(item.price == '' || item.price == 0){
this.alertMessage('请商品规格价格')
return
} else if(item.stock == ''){
this.alertMessage('请商品规格库存')
} else if(item.stock == '' || item.stock == 0){
this.alertMessage('库存不能为0')
return
}
})
if(this.id != ''){
form.id = this.id
form.spec_type = this.spec_type
console.log(form)
editProduct(form).then((res)=>{
if(res.success){
uni.showToast({
@ -448,6 +481,8 @@
}
})
} else{
form.spec_type = this.batchData.priceArr.length > 1 ? 1 : 0
console.log(form)
addProduct(form).then((res)=>{
if(res.success){
uni.showToast({
@ -603,6 +638,7 @@
padding: 32rpx;
font-size: 28rpx;
font-weight: 500;
margin-bottom: 12rpx;
image{
width: 24rpx;
height: 24rpx;
@ -682,14 +718,46 @@
width: 19%;
text-align: center;
}
.batch{
font-size: 24rpx;
color: #000;
image{
width: 24rpx;
height: 26rpx;
margin-right: 10rpx;
}
}
}
.box-b{
margin-top: 6rpx;
.name{
width: 100%;
height: 100rpx;
background: #FFFFFF;
border: 2rpx solid #C0C0C0;
border-radius: 8rpx;
margin-top: 22rpx;
padding: 0 20rpx;
.box-b-l{
width: 60%;
.name{
width: calc(100% - 90rpx);
}
.w15{
width: 19%;
.attrImg{
width: 70rpx;
height: 70rpx;
border-radius: 8rpx;
margin-right: 16rpx;
}
}
.box-b-r{
font-size: 24rpx;
color: #FF0000;
font-weight: 500;
margin-right: 14rpx;
}
.arrow{
width: 24rpx;
height: 24rpx;
transform: rotate(90deg);
}
.inp-box{
text-align: center;
@ -703,6 +771,62 @@
}
}
}
.set-attr-val{
width: 100%;
padding: 0 40rpx 90rpx;
border-radius: 60rpx 60rpx 0px 0px;
background:#fff;
box-shadow: 0px 6rpx 12rpx rgba(0, 0, 0, 0.2);
position: fixed;
left: 0;
bottom: -999rpx;
transition: bottom .2s ease ;
&.isShow{
bottom: 0;
}
.title{
font-size: 44rpx;
color: #343434;
text-align: center;
padding: 44rpx 0;
}
.inp-box{
display: flex;
align-items: center;
width: 100%;
height: 72rpx;
background: #F1F1F1;
border-radius: 8rpx;
padding: 0 40rpx;
font-size: 32rpx;
color: #000;
margin-bottom: 28rpx;
text{
width: 200rpx;
display: inline-block;
}
}
.btn-box{
display: flex;
justify-content: space-around;
view{
width: 230rpx;
height: 80rpx;
text-align: center;
line-height: 80rpx;
background: #E9E9E9;
border-radius: 40rpx;
font-size: 38rpx;
color: #fff;
}
.cancel-btn{
bakcground:#E9E9E9
}
.submit-btn{
background: linear-gradient(134deg, #FFA782 0%, #FF6D31 100%);
}
}
}
//
.mask-box{
width: 100%;
@ -730,7 +854,7 @@
}
.a-name{
width: 560rpx;
height: 104rpx;
// height: 104rpx;
background: #F7F7F7;
border-radius: 12rpx;
padding: 30rpx;
@ -745,7 +869,7 @@
width: 80%;
}
.o-item-box{
height: 56rpx;
height: 74rpx;
padding-bottom: 10rpx;
margin-bottom: 10rpx;
border-bottom: 2rpx solid #ececec;

7
pages/life/index.vue

@ -18,7 +18,7 @@
</view>
</div>
</view>
<view class="banner-img-box acea-row row-between-wrapper">
<!-- <view class="banner-img-box acea-row row-between-wrapper">
<view class="img-box-l">
<image src="https://download.cyjyyjy.com/life1.png" @click="alertMessage('功能开发中...')"></image>
</view>
@ -26,7 +26,7 @@
<image src="https://download.cyjyyjy.com/life2.png" @click="alertMessage('功能开发中...')"></image>
<image src="https://download.cyjyyjy.com/life3.png" @click="alertMessage('功能开发中...')"></image>
</view>
</view>
</view> -->
<view class="category-tab-box">
<scroll-view class="scroll-view_H" scroll-x="true" >
<view class="category-item category-item-active">全部商品</view>
@ -278,6 +278,7 @@ export default {
line-height: 108rpx;
padding-left: 30rpx;
margin-bottom: 30rpx;
padding-top: 190rpx;
.scroll-view_H{
white-space: nowrap;
width: 100%;
@ -310,7 +311,7 @@ export default {
.warter-box{
width: 100%;
padding: 0 0 190rpx 24rpx;
padding: 92rpx 0 190rpx 24rpx;
.u-waterfall {
width: 100%;
display: flex;

1
pages/release/companyAuth/index.vue

@ -226,6 +226,7 @@
this.form.enterpriseName = authInfo.enterpriseName;
this.form.authorizationPath = authInfo.authorizationPath || '';
this.form.isLegalPerson = 0;
this.isEdit = true
}
},
methods: {

58
pages/release/perfectPersonInfo/index.vue

@ -117,37 +117,6 @@ export default {
this.getEnterpriseInfo();
}
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {},
/**
* 用户点击右上角分享
*/
@ -182,9 +151,6 @@ export default {
},
timeChange(e) {
this.setData({//['form.establishmentTime']: e.detail.value
});
//try fix
this.form.establishmentTime = e.detail.value;
},
@ -193,33 +159,14 @@ export default {
app.http('GET', 'Enterprise/getEnterpriseInfo').then(res => {
if (res.data.success) {
let data = res.data.data;
this.setData({//['form.enterpriseScale']: data.enterpriseScale
//['form.enterpriseAddress']: data.enterpriseAddress
//['form.businessNature']: data.businessNature
//['form.establishmentTime']: data.establishmentTime
//['form.latitude']: data.latitude
//['form.longitude']: data.longitude
//['form.enterprisePhone']: data.enterprisePhone
//['form.resourceIntroduction']: data.resourceIntroduction
//['form.imgPaths']: data.imgPaths
});
//try fix
this.form.imgPaths = data.imgPaths;
//try fix
this.form.resourceIntroduction = data.resourceIntroduction;
//try fix
this.form.enterprisePhone = data.enterprisePhone;
//try fix
this.form.longitude = data.longitude;
//try fix
this.form.latitude = data.latitude;
//try fix
this.form.establishmentTime = data.establishmentTime;
//try fix
this.form.businessNature = data.businessNature;
//try fix
this.form.enterpriseAddress = data.enterpriseAddress;
//try fix
this.form.enterpriseScale = data.enterpriseScale;
}
});
@ -276,13 +223,10 @@ export default {
},
resourcesChange(e) {
// console.log(e)
let idx = Number(e.detail.value);
this.setData({//['form.industryId']: this.data.resourcesList[idx].id
this.setData({
resourcesIdx: idx,
});
//try fix
this.form.industryId = this.resourcesList[idx].id;
},

19
pages/release/personAuth/index.vue

@ -74,33 +74,14 @@ export default {
onLoad: function (options) {
if (options.authInfo) {
let authInfo = JSON.parse(decodeURIComponent(options.authInfo));
this.setData({
//['form.legalPersonName']: authInfo.legalPersonName
//['form.legalPhone']: authInfo.legalPhone || ''
//['form.legalPersonIdcard']: authInfo.legalPersonIdcard
//['form.idcardPicFront']: authInfo.idcardPicFront
//['form.idcardPicBehind']: authInfo.idcardPicBehind
//['form.idcardPicHold']: authInfo.idcardPicHold
//['form.id']: authInfo.id
//['form.authorizationType']: 2
// isEdit: true,
});
this.isEdit = true,
//try fix
this.form.authorizationType = 2;
//try fix
this.form.id = authInfo.id;
//try fix
this.form.idcardPicHold = authInfo.idcardPicHold;
//try fix
this.form.idcardPicBehind = authInfo.idcardPicBehind;
//try fix
this.form.idcardPicFront = authInfo.idcardPicFront;
//try fix
this.form.legalPersonIdcard = authInfo.legalPersonIdcard;
//try fix
this.form.legalPhone = authInfo.legalPhone || '';
//try fix
this.form.legalPersonName = authInfo.legalPersonName;
}
},

5
pages/user/goodsManage/index.vue

@ -117,6 +117,11 @@
title: res.msg
})
this.changeType(this.type)
} else{
uni.showToast({
title: res.msg,
icon: 'none'
})
}
})
},

BIN
static/images/batch-icon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 569 B

Loading…
Cancel
Save