2024-04-18 18:02:57 +08:00
|
|
|
<template>
|
|
|
|
<view class="content">
|
2024-04-19 18:08:04 +08:00
|
|
|
<view class="">
|
2024-04-20 14:51:26 +08:00
|
|
|
<u-button icon="plus" text="新增规格" @click="attrValue.push({})" class="custom-style"
|
|
|
|
iconColor='#38BE41'></u-button>
|
2024-04-19 18:08:04 +08:00
|
|
|
</view>
|
2024-04-20 14:51:26 +08:00
|
|
|
<view class="card" v-for="(item,index) in attrValue">
|
2024-04-18 23:59:06 +08:00
|
|
|
<view class="card-head card-li">
|
2024-04-20 14:51:26 +08:00
|
|
|
<text style="font-size: 32rpx;font-family: PingFangFamily;">规格{{index+1}}</text>
|
2024-04-20 18:02:16 +08:00
|
|
|
<view class="" style="width: 300rpx;">
|
|
|
|
<u--input placeholder="请输入规格名称" inputAlign='right' v-model="item.spec_type"></u--input>
|
2024-04-18 23:59:06 +08:00
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<u-line direction="row" style="margin: 30rpx 0;" color="#ECECEC"></u-line>
|
2024-04-20 14:51:26 +08:00
|
|
|
|
|
|
|
<view class="">
|
|
|
|
<view class="" style="display: flex;align-items: center;justify-content: space-between;">
|
|
|
|
<u--input style="flex: 2; background-color: #F6F6F6;" placeholder="请输入商品单价"
|
|
|
|
v-model="item.price"></u--input>
|
|
|
|
<view class="" style="flex: 1;text-align: center;">
|
|
|
|
/
|
|
|
|
</view>
|
|
|
|
<u--input style=" flex: 2;width:100rpx;background-color: #F6F6F6;" placeholder="请输入计量单位"
|
|
|
|
v-model="item.unit_name"></u--input>
|
|
|
|
</view>
|
2024-04-20 18:02:16 +08:00
|
|
|
<view class="" v-if='isWholeSale'
|
2024-04-20 14:51:26 +08:00
|
|
|
style="display: flex;align-items: center;justify-content: space-between;margin-top: 30rpx;">
|
|
|
|
<u--input style="flex: 2; background-color: #F6F6F6;" placeholder="请输批发价格"
|
|
|
|
v-model="item.wholesale_price"></u--input>
|
|
|
|
<view class="" style="flex: 1;text-align: center;">
|
|
|
|
/
|
|
|
|
</view>
|
|
|
|
<u--input style=" flex: 2;width:100rpx;background-color: #F6F6F6;" placeholder="请输入计量单位"
|
|
|
|
v-model="item.wholesale_unit_name"></u--input>
|
2024-04-18 23:59:06 +08:00
|
|
|
</view>
|
|
|
|
</view>
|
2024-04-19 18:08:04 +08:00
|
|
|
<u-line direction="row" style="margin: 25rpx 0;" color="#ECECEC"></u-line>
|
2024-04-18 23:59:06 +08:00
|
|
|
<view class=" card-li">
|
2024-04-19 18:08:04 +08:00
|
|
|
<text style="font-size: 32rpx;">商品库存</text>
|
2024-04-20 18:02:16 +08:00
|
|
|
<view class="" style="width: 300rpx;">
|
|
|
|
<u--input placeholder="请填写库存数量" inputAlign='right' v-model="item.stock"></u--input>
|
2024-04-18 23:59:06 +08:00
|
|
|
</view>
|
|
|
|
</view>
|
2024-04-19 18:08:04 +08:00
|
|
|
<u-line direction="row" style="margin: 25rpx 0;" color="#ECECEC"></u-line>
|
2024-04-18 23:59:06 +08:00
|
|
|
<view class=" card-li">
|
2024-04-19 18:08:04 +08:00
|
|
|
<text style="font-size: 32rpx;">条形码</text>
|
2024-04-20 18:02:16 +08:00
|
|
|
<view class="" style="width: 300rpx;">
|
|
|
|
<u--input placeholder="请填写商品条形码" inputAlign='right' v-model="item.bar_code"></u--input>
|
2024-04-18 23:59:06 +08:00
|
|
|
</view>
|
|
|
|
</view>
|
2024-04-19 18:08:04 +08:00
|
|
|
<u-line direction="row" style="margin: 25rpx 0;" color="#ECECEC"></u-line>
|
2024-04-18 23:59:06 +08:00
|
|
|
<view class="card-li">
|
2024-04-20 14:51:26 +08:00
|
|
|
<view style="display: flex;color: #777777;" @click="attrValue.splice(index,1)">
|
2024-04-18 23:59:06 +08:00
|
|
|
<u-icon name="trash" style='margin-right: 8rpx;'></u-icon> 删除
|
|
|
|
</view>
|
|
|
|
<view class="" style="display: flex;align-items: center;">
|
2024-04-20 14:51:26 +08:00
|
|
|
<u-switch v-model="item.open" type='primaryy' activeColor="#38BE41" size="19"></u-switch>
|
2024-04-19 18:08:04 +08:00
|
|
|
<text style="margin-left: 8rpx;color: #777777;">启用</text>
|
2024-04-18 23:59:06 +08:00
|
|
|
</view>
|
2024-04-18 18:02:57 +08:00
|
|
|
</view>
|
|
|
|
</view>
|
2024-04-20 14:51:26 +08:00
|
|
|
<view class="submit-btn">
|
|
|
|
<u-button type="primary" shape="circle" text="保存" @click="submit"></u-button>
|
|
|
|
</view>
|
2024-04-18 18:02:57 +08:00
|
|
|
</view>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2024-04-18 23:59:06 +08:00
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
2024-04-20 18:02:16 +08:00
|
|
|
mer_id: "",
|
|
|
|
isWholeSale: "",
|
2024-04-18 23:59:06 +08:00
|
|
|
text: "",
|
2024-04-20 14:51:26 +08:00
|
|
|
value: "",
|
2024-04-20 18:02:16 +08:00
|
|
|
formData: {},
|
2024-04-20 14:51:26 +08:00
|
|
|
attrValue: [{
|
|
|
|
spec_type: "",
|
|
|
|
"price": "100",
|
|
|
|
"unit_name": "箱",
|
|
|
|
"wholesale_unit_name": "件",
|
|
|
|
"wholesale_price": 88,
|
|
|
|
"cost": "",
|
|
|
|
"stock": "20",
|
|
|
|
"ot_price": "",
|
|
|
|
"procure_price": "",
|
|
|
|
"bar_code": "5656",
|
|
|
|
"weight": "",
|
|
|
|
"volume": "",
|
|
|
|
"extension_one": "",
|
|
|
|
"extension_two": "",
|
2024-04-20 18:02:16 +08:00
|
|
|
open: true
|
2024-04-20 14:51:26 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
],
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
submit() {
|
2024-04-20 18:02:16 +08:00
|
|
|
this.formData.attrValue = this.attrValue
|
|
|
|
let that = this
|
|
|
|
uni.navigateTo({
|
|
|
|
url: `/pages/product/addGoodDetail/addGoodDetail?formData=${JSON.stringify(that.formData) }&&mer_id=${that.mer_id}`
|
|
|
|
})
|
2024-04-20 14:51:26 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
onLoad(option) {
|
2024-04-20 18:02:16 +08:00
|
|
|
this.isWholeSale = this.$store.state.app.userInfo?.mer_info?.wholesale == 2;
|
|
|
|
if (option.formData) {
|
|
|
|
this.formData = JSON.parse(option.formData)
|
|
|
|
this.attrValue = this.formData.attrValue
|
2024-04-18 23:59:06 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2024-04-18 18:02:57 +08:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang='scss'>
|
|
|
|
.custom-style {
|
|
|
|
color: $uni-newTheme-color;
|
|
|
|
height: 104rpx;
|
|
|
|
}
|
|
|
|
|
|
|
|
.content {
|
|
|
|
box-sizing: border-box;
|
|
|
|
padding: 30rpx;
|
|
|
|
background-color: #F1F1F1;
|
|
|
|
min-height: 100vh;
|
|
|
|
position: relative;
|
|
|
|
font-size: 28rpx;
|
2024-04-19 18:08:04 +08:00
|
|
|
font-family: PingFangRegular;
|
|
|
|
/* font-family: PingFangFamily; */
|
|
|
|
|
2024-04-18 18:02:57 +08:00
|
|
|
|
|
|
|
.card {
|
|
|
|
margin-top: 30rpx;
|
|
|
|
padding: 30rpx 46rpx;
|
|
|
|
background-color: white;
|
|
|
|
border-radius: 16rpx 16rpx 16rpx 16rpx;
|
|
|
|
box-shadow: 0rpx 6rpx 12rpx 2rpx rgba(0, 0, 0, 0.16);
|
2024-04-18 23:59:06 +08:00
|
|
|
position: relative;
|
|
|
|
|
|
|
|
.card-li {
|
|
|
|
display: flex;
|
|
|
|
justify-content: space-between;
|
|
|
|
align-items: center;
|
|
|
|
}
|
2024-04-18 18:02:57 +08:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.card-head::after {
|
|
|
|
content: '';
|
|
|
|
position: absolute;
|
|
|
|
font-size: 32rpx;
|
2024-04-18 23:59:06 +08:00
|
|
|
left: 20rpx;
|
|
|
|
width: 8rpx;
|
2024-04-18 18:02:57 +08:00
|
|
|
height: 32rpx;
|
2024-04-18 23:59:06 +08:00
|
|
|
top: 50rpx;
|
|
|
|
background-color: #40AE36;
|
|
|
|
border-radius: 4rpx 4rpx 4rpx 4rpx;
|
2024-04-18 18:02:57 +08:00
|
|
|
}
|
|
|
|
|
2024-04-20 14:51:26 +08:00
|
|
|
.submit-btn {
|
|
|
|
position: fixed;
|
|
|
|
bottom: 50rpx;
|
|
|
|
width: 670rpx;
|
|
|
|
}
|
2024-04-18 18:02:57 +08:00
|
|
|
}
|
|
|
|
</style>
|