新增选择规格模板
This commit is contained in:
parent
c6a082d1d7
commit
22acdfa746
|
@ -3,14 +3,13 @@
|
||||||
<view class="mode">
|
<view class="mode">
|
||||||
<view class="line">
|
<view class="line">
|
||||||
<view class="title">规格模板</view>
|
<view class="title">规格模板</view>
|
||||||
|
<picker style="flex: 1;" mode="selector" :range="attr_mode_list" range-key="template_name" @change="changAttrMode">
|
||||||
<view class="input">
|
<view class="input">
|
||||||
<view>点击选择模板</view>
|
<view>{{template_name}}</view>
|
||||||
<uni-icons type="right"></uni-icons>
|
<uni-icons type="right"></uni-icons>
|
||||||
</view>
|
</view>
|
||||||
|
</picker>
|
||||||
<view class="btn">添加模板</view>
|
<view class="btn">添加模板</view>
|
||||||
</view>
|
|
||||||
<view class="line-warp">
|
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
<view class="btn-box" @click="settingSpec()">
|
<view class="btn-box" @click="settingSpec()">
|
||||||
<view class="btn">点击设置规格</view>
|
<view class="btn">点击设置规格</view>
|
||||||
|
@ -58,6 +57,7 @@
|
||||||
</view>
|
</view>
|
||||||
</uni-popup>
|
</uni-popup>
|
||||||
</view>
|
</view>
|
||||||
|
<view style="height: 160rpx;"></view>
|
||||||
<avatar style="height: 1px;" @upload="doUpload" @getName="getImgName" quality="1" ref="avatar" selWidth="250upx"
|
<avatar style="height: 1px;" @upload="doUpload" @getName="getImgName" quality="1" ref="avatar" selWidth="250upx"
|
||||||
selHeight="250upx">
|
selHeight="250upx">
|
||||||
</avatar>
|
</avatar>
|
||||||
|
@ -109,7 +109,8 @@
|
||||||
import { TOKENNAME, HTTP_REQUEST_URL } from '@/config/app.js';
|
import { TOKENNAME, HTTP_REQUEST_URL } from '@/config/app.js';
|
||||||
import { Toast } from "../../../libs/uniApi";
|
import { Toast } from "../../../libs/uniApi";
|
||||||
import {
|
import {
|
||||||
specificationUpdate
|
specificationUpdate,
|
||||||
|
attrList
|
||||||
} from "@/api/product.js"
|
} from "@/api/product.js"
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
|
@ -120,7 +121,9 @@
|
||||||
return {
|
return {
|
||||||
attrValue: [],
|
attrValue: [],
|
||||||
attr: [],
|
attr: [],
|
||||||
attr_mode: {
|
attr_mode_list: [], //规格模板列表
|
||||||
|
template_name: '点击选择模板', //选中的模板名字
|
||||||
|
attr_mode: { // 规格字段模板
|
||||||
"detail": {},
|
"detail": {},
|
||||||
"sku": "",
|
"sku": "",
|
||||||
"stock": 0,
|
"stock": 0,
|
||||||
|
@ -158,6 +161,7 @@
|
||||||
})
|
})
|
||||||
this.userInfo = this.$store.state.app.userInfo;
|
this.userInfo = this.$store.state.app.userInfo;
|
||||||
if (typeof this.userInfo == 'string') this.userInfo = JSON.parse(this.userInfo);
|
if (typeof this.userInfo == 'string') this.userInfo = JSON.parse(this.userInfo);
|
||||||
|
this.initAttrModeList();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
updateCode(e) {
|
updateCode(e) {
|
||||||
|
@ -421,6 +425,23 @@
|
||||||
deleteAttr() {
|
deleteAttr() {
|
||||||
this.attrValue.splice(this.deleteIndex, 1);
|
this.attrValue.splice(this.deleteIndex, 1);
|
||||||
this.showDelete = false;
|
this.showDelete = false;
|
||||||
|
},
|
||||||
|
// 初始化规格模板
|
||||||
|
initAttrModeList(){
|
||||||
|
attrList(this.userInfo.service.mer_id,{
|
||||||
|
page: 1,
|
||||||
|
limit: 10000
|
||||||
|
}).then((res)=>{
|
||||||
|
console.log(res);
|
||||||
|
this.attr_mode_list = res.data.list;
|
||||||
|
})
|
||||||
|
},
|
||||||
|
changAttrMode(e){
|
||||||
|
this.attr_template_id = this.attr_mode_list[e.detail.value].attr_template_id;
|
||||||
|
this.template_name = this.attr_mode_list[e.detail.value].template_name;
|
||||||
|
this.attr = JSON.parse(JSON.stringify(this.attr_mode_list[e.detail.value].template_value));
|
||||||
|
this.$set(this, 'attrValue', []);
|
||||||
|
this.addAttrValueCard();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onBackPress: () => {
|
onBackPress: () => {
|
||||||
|
@ -514,9 +535,14 @@
|
||||||
.mode {
|
.mode {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
z-index: 1;
|
||||||
|
|
||||||
.line {
|
.line {
|
||||||
padding: 28rpx;
|
padding: 0 28rpx;
|
||||||
|
height: 80rpx;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
@ -542,16 +568,13 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.line-warp {
|
|
||||||
padding: 0 28rpx;
|
|
||||||
display: flex;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-box {
|
.btn-box {
|
||||||
padding: 20rpx 28rpx;
|
height: 80rpx;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
border-top: 1rpx solid #eee;
|
border-top: 1rpx solid #eee;
|
||||||
|
border-bottom: 1rpx solid #eee;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mode-ref {
|
.mode-ref {
|
||||||
|
|
Loading…
Reference in New Issue