pull/9/head
zhangyouji 12 months ago
parent 53aa029391
commit 7cf3af639d
  1. 102
      packageIntegral/productAddition/index.vue
  2. 20
      packageIntegral/productList/index.vue
  3. 178
      packageIntegral/productUpdate/index.vue

@ -6,7 +6,7 @@
</cu-custom>
<view id="chooseType" :class="currentBoxId == 'chooseType' ? 'show' : 'hidden'">
<uni-forms ref="productForm" :modelValue="productDate" :rules="rules" label-width="200rpx">
<uni-forms-item label="商品分类:" name="name">
<uni-forms-item label="商品分类:" name="demandRegion">
<mulpicker
v-model="productDate.demandRegion"
:list="productList"
@ -74,20 +74,20 @@
<view class="uni-px-5" v-for="(item,index) in attributesList">
<view style="display: inline-block;">{{item.attributeName}}</view>
<view style="display: inline-block;">
<uni-data-checkbox v-if="index==0" mode="tag" v-model="radioAttributes" :localdata="item.attributesList"></uni-data-checkbox>
<uni-data-checkbox v-else-if="index!=0" mode="tag" multiple v-model="checkboxAttributes" :localdata="hobby"></uni-data-checkbox>
<uni-data-checkbox v-if="index==0" mode="tag" @change="changeRadio(item,index)" v-model="radioAttributes" :localdata="item.attributesList"></uni-data-checkbox>
<uni-data-checkbox v-else-if="index!=0" mode="tag" @change="changeCheckBox(item,index)" multiple v-model="checkboxAttributes" :localdata="item.attributesList"></uni-data-checkbox>
</view>
</view>
</uni-section>
</view>
</view>
<view>
<view style="padding-bottom: 20rpx;border-bottom: 1rpx solid #f6f6f6;">
<view>批量填充<text style="color: #999999;margin: 10rpx 0;">批量填充填入信息后可以批量将内容填写到SKU 信息里</text></view>
<view class="tagButton" @tap="changeChecked(item)" v-for="item in bottonList">{{item.label}}</view>
<view class="tagButton" v-for="item in bottonList">{{item.label}}</view>
<view class="redButton" @tap="addStockList">确定</view>
</view>
<view v-for="(items,index) in stockList">
<view style="padding: 20rpx 0;;border-bottom: 1rpx solid #f6f6f6;" v-for="(items,index) in stockList">
<view style="margin: 10rpx 0;">
<text style="color: red;">*</text>
<text>规格</text>
@ -163,6 +163,7 @@
currentBoxId: 'chooseType', //viewid
isBoxShow: false,
productDate:{
productStatus:'1',
images:[]
},
productList:[],
@ -175,9 +176,9 @@
checked: false
}],
rules:{
name:{rules:[{required: true,errorMessage: '请选择商品分类'}]},
demandRegion:{rules:[{required: true,errorMessage: '请选择商品分类'}]},
productName:{rules:[{required: true,errorMessage: '请输入商品名称'}]},
brandId:{rules:[{required: true,errorMessage: '请输入商品品牌'}]},
brandId:{rules:[{required: true,errorMessage: '请选择商品品牌'}]},
price:{rules:[{required: true,errorMessage: '请输入商品售价'}]},
},
attributesTypeList:[],
@ -190,7 +191,8 @@
],
radioAttributes:'',
checkboxAttributes:[],
stockList:[]
stockList:[],
checkedList:[]
}
},
@ -205,6 +207,11 @@
this.productDate.categoryOneId = val.split(',')[0]
this.productDate.categoryTwoId = val.split(',')[1]
}
},
'productDate.attributesTypeId'(val){
if(!val){
this.stockList = []
}
}
},
methods: {
@ -257,20 +264,40 @@
},
changeBox(e){
let currentFlag = e.currentTarget.id;
switch(currentFlag){
case 'next':
this.currentBoxId = 'instruction'
break;
case 'previous':
this.currentBoxId = 'chooseType'
break;
default:
this.currentBoxId = 'viewInstruction'
break;
}
if(currentFlag == 'next'){
this.getAttributesType()
this.$refs.productForm.validate().then(res=>{
console.log('表单数据信息:', res);
switch(currentFlag){
case 'next':
this.currentBoxId = 'instruction'
break;
case 'previous':
this.currentBoxId = 'chooseType'
break;
default:
this.currentBoxId = 'viewInstruction'
break;
}
if(currentFlag == 'next'){
this.getAttributesType()
}
}).catch(err =>{
console.log('表单错误信息:', err);
})
}else{
switch(currentFlag){
case 'next':
this.currentBoxId = 'instruction'
break;
case 'previous':
this.currentBoxId = 'chooseType'
break;
default:
this.currentBoxId = 'viewInstruction'
break;
}
}
},
getAttributesType(){
this.attributesTypeList = []
@ -304,6 +331,25 @@
}
},
changeRadio(item,index){
if(JSON.stringify(this.checkedList) == '[]'){
this.checkedList.push({attributeId:item.id,checked:item.attributeName})
}else{
this.checkedList[index].checked = item.attributeName
}
},
changeCheckBox(item,index){
if(this.checkedList.length<index+1){
this.checkedList.push({attributeId:item.id,checked:item.attributeName})
}else{
let checked = []
this.checkboxAttributes.forEach(tab=>{
checked.push(tab)
})
this.checkedList[index].checked = checked.join(',')
this.checkedList.checked
}
},
deleteCheckAll(i){
if(this.checkboxAttributes.length>1){
this.checkboxAttributes.splice(i,1)
@ -358,7 +404,6 @@
sourceType: ['album'], //
success: function(res) {
console.log(res)
console.log('进入1')
const JSESSIONID = utils.uuid()
uni.uploadFile({
url: 'http://uat.xingoil.com/adminapi/oil-oss/obejct/uploadFile',
@ -379,14 +424,11 @@
'token': utils.md5Salt(JSESSIONID)
},
success(e) {
console.log('进入2')
console.log(e)
let obj = JSON.parse(e.data),
imageUrl = obj.data.publicUrl
_that.getImage(imageUrl)
},
fail(err) {
console.log(err)
}
})
},fail() {
@ -440,9 +482,15 @@
}else{
this.productDate.recommend == '2'
}
this.productDate.checkedList = this.checkedList
this.productDate.stockList = this.stockList
serve.saveProduct(this.productDate).then(res=>{
console.log(res)
uni.showToast({
title: res.msg,
icon: 'none'
})
this.closed()
})
}
}
@ -524,6 +572,10 @@
line-height: 72rpx;
}
}
.content{
padding-bottom: 20rpx;
border-bottom: 1rpx solid #F6F6F6;
}
.tagButton{
display: inline-block;
width: 133rpx;

@ -17,12 +17,12 @@
<scroll-view v-if="dataList.length" class="list" :scroll-y="true" @scrolltolower="lower">
<view class="item" v-for="item,index in dataList" :key="index">
<view class="header" @click="toDetails(item)">
<view class="header">
<view class="identifying"
:style="{background:identifying[item.productStatus].background,
opacity:identifying[item.productStatus].opacity}">{{item.productStatus =='1'?'已上架':'未上架'}}</view>
</view>
<view class="introduce" @click="toDetails(item)">
<view class="introduce">
<image :src="item.url"></image>
<view>{{item.productName}}</view>
<view>规格默认</view>
@ -192,11 +192,11 @@
}, '')
return text
},
toDetails(item) {
uni.navigateTo({
url: `../orderDetails/index?orderId=${item.id}`
})
},
// toDetails(item) {
// uni.navigateTo({
// url: `../orderDetails/index?orderId=${item.id}`
// })
// },
getTopInfo(){
serve.getTopInfo(this.paramter).then(res => {
if (res.code === 20000) {
@ -246,7 +246,7 @@
uni.navigateTo({
url: `../productUpdate/index?id=${item.id}`
})
},
upDownFrame(item) {
this.productData = item
@ -260,7 +260,7 @@
}else if(this.productData.productStatus ==2){
data.productStatus = 1
}
serve.productStatus(data).then(res=>{
uni.showToast({
title: res.msg,
@ -489,7 +489,7 @@
width: 160rpx;
}
}
.header{
font-size: 32rpx;
color: #000;

@ -6,14 +6,14 @@
</cu-custom>
<view id="chooseType" :class="currentBoxId == 'chooseType' ? 'show' : 'hidden'">
<uni-forms ref="productForm" :modelValue="productDate" :rules="rules" label-width="200rpx">
<uni-forms-item label="商品分类:" name="name">
<uni-forms-item label="商品分类:" name="demandRegion">
<mulpicker
v-model="productDate.demandRegion"
:list="productList"
:list="productList"
rangekey="categoryName"
code="id"
pidkey="id"
childkey="classificationTwoList"
pidkey="id"
childkey="classificationTwoList"
:emitPath="true"
:level="2"
:placeholder="'选择商品分类'"
@ -55,8 +55,8 @@
<view id="next" @click="changeBox">下一步</view>
</view>
</view>
<view id="instruction" :class="currentBoxId == 'instruction' ? 'show' : 'hidden'">
<uni-forms :modelValue="productDate" label-width="200rpx">
<uni-forms-item label="属性类别:" >
@ -74,20 +74,20 @@
<view class="uni-px-5" v-for="(item,index) in attributesList">
<view style="display: inline-block;">{{item.attributeName}}</view>
<view style="display: inline-block;">
<uni-data-checkbox v-if="index==0" mode="tag" v-model="radioAttributes" :localdata="item.attributesList"></uni-data-checkbox>
<uni-data-checkbox v-else-if="index!=0" mode="tag" multiple v-model="checkboxAttributes" :localdata="hobby"></uni-data-checkbox>
<uni-data-checkbox v-if="index==0" mode="tag" @change="changeRadio(item,index)" v-model="radioAttributes" :localdata="item.attributesList"></uni-data-checkbox>
<uni-data-checkbox v-else-if="index!=0" mode="tag" @change="changeCheckBox(item,index)" multiple v-model="checkboxAttributes" :localdata="item.attributesList"></uni-data-checkbox>
</view>
</view>
</uni-section>
</view>
</view>
<view>
<view style="padding-bottom: 20rpx;border-bottom: 1rpx solid #f6f6f6;">
<view>批量填充<text style="color: #999999;margin: 10rpx 0;">批量填充填入信息后可以批量将内容填写到SKU 信息里</text></view>
<view class="tagButton" @tap="changeChecked(item)" v-for="item in bottonList">{{item.label}}</view>
<view class="redButton" @tap="addStockList">确定</view>
</view>
<view v-for="(items,index) in stockList">
<view style="padding: 20rpx 0;;border-bottom: 1rpx solid #f6f6f6;" v-for="(items,index) in stockList">
<view style="margin: 10rpx 0;">
<text style="color: red;">*</text>
<text>规格</text>
@ -131,7 +131,7 @@
<uni-icons type="camera-filled" size="30"></uni-icons>
</view>
</view>
</view>
<!-- <view>
<view>详情图片<text style="color: #999999;">最多可上传10张图片</text></view>
@ -143,7 +143,7 @@
<view @click="addCompleted">完成</view>
</view>
</view>
@ -163,6 +163,7 @@
currentBoxId: 'chooseType', //viewid
isBoxShow: false,
productDate:{
productStatus:'1',
images:[]
},
productList:[],
@ -175,9 +176,9 @@
checked: false
}],
rules:{
name:{rules:[{required: true,errorMessage: '请选择商品分类'}]},
demandRegion:{rules:[{required: true,errorMessage: '请选择商品分类'}]},
productName:{rules:[{required: true,errorMessage: '请输入商品名称'}]},
brandId:{rules:[{required: true,errorMessage: '请输入商品品牌'}]},
brandId:{rules:[{required: true,errorMessage: '请选择商品品牌'}]},
price:{rules:[{required: true,errorMessage: '请输入商品售价'}]},
},
attributesTypeList:[],
@ -190,7 +191,8 @@
],
radioAttributes:'',
checkboxAttributes:[],
stockList:[]
stockList:[],
checkedList:[]
}
},
@ -207,7 +209,12 @@
this.productDate.categoryOneId = val.split(',')[0]
this.productDate.categoryTwoId = val.split(',')[1]
}
}
},
'productDate.attributesTypeId'(val){
if(!val){
this.stockList = []
}
}
},
methods: {
getEdit(options){
@ -236,6 +243,7 @@
})
}
})
this.checkedList = this.productDate.checkedList
if(this.productDate.checkedList.length==1){
this.radioAttributes = this.productDate.checkedList[0].checked
}else{
@ -247,8 +255,8 @@
})
}
this.stockList = this.productDate.stockList
}
console.log(res.data)
})
@ -272,7 +280,7 @@
res.data.forEach(tab=>{
this.brandIdList.push({value:tab.id,text:tab.brandName})
})
})
},
checkbox (e) {
@ -298,24 +306,44 @@
}else{
this.productDate.recommend = 2
}
},
changeBox(e){
let currentFlag = e.currentTarget.id;
switch(currentFlag){
case 'next':
this.currentBoxId = 'instruction'
break;
case 'previous':
this.currentBoxId = 'chooseType'
if(currentFlag == 'next'){
this.$refs.productForm.validate().then(res=>{
console.log('表单数据信息:', res);
switch(currentFlag){
case 'next':
this.currentBoxId = 'instruction'
break;
case 'previous':
this.currentBoxId = 'chooseType'
break;
default:
this.currentBoxId = 'viewInstruction'
break;
}
if(currentFlag == 'next'){
this.getAttributesType()
}
}).catch(err =>{
console.log('表单错误信息:', err);
})
}else{
switch(currentFlag){
case 'next':
this.currentBoxId = 'instruction'
break;
case 'previous':
this.currentBoxId = 'chooseType'
break;
default:
this.currentBoxId = 'viewInstruction'
break;
default:
this.currentBoxId = 'viewInstruction'
break;
}
if(currentFlag == 'next'){
this.getAttributesType()
}
}
}
},
getAttributesType(){
this.attributesTypeList = []
@ -328,7 +356,7 @@
attributesList:tab.attributesList
})
})
})
})
},
attributesData(){
if(this.productDate.attributesTypeId){
@ -341,14 +369,33 @@
tab.attributesList.push({value:item,text:item})
})
})
}
})
})
}else{
this.attributesList = []
}
},
changeRadio(item,index){
if(JSON.stringify(this.checkedList) == '[]'){
this.checkedList.push({attributeId:item.id,checked:item.attributeName})
}else{
this.checkedList[index].checked = item.attributeName
}
},
changeCheckBox(item,index){
if(this.checkedList.length<index+1){
this.checkedList.push({attributeId:item.id,checked:item.attributeName})
}else{
let checked = []
this.checkboxAttributes.forEach(tab=>{
checked.push(tab)
})
this.checkedList[index].checked = checked.join(',')
this.checkedList.checked
}
},
deleteCheckAll(i){
if(this.checkboxAttributes.length>1){
this.checkboxAttributes.splice(i,1)
@ -390,7 +437,7 @@
obj.attributeJson = JSON.stringify(data)
this.stockList.push(obj)
})
}
},
//
@ -402,8 +449,6 @@
sizeType: ['original', 'compressed'], //
sourceType: ['album'], //
success: function(res) {
console.log(res)
console.log('进入1')
const JSESSIONID = utils.uuid()
uni.uploadFile({
url: 'http://uat.xingoil.com/adminapi/oil-oss/obejct/uploadFile',
@ -424,14 +469,11 @@
'token': utils.md5Salt(JSESSIONID)
},
success(e) {
console.log('进入2')
console.log(e)
let obj = JSON.parse(e.data),
imageUrl = obj.data.publicUrl
_that.getImage(imageUrl)
},
fail(err) {
console.log(err)
}
})
},fail() {
@ -483,21 +525,31 @@
}else{
this.productDate.recommend == '2'
}
this.productDate.checkedList = this.checkedList
this.productDate.stockList = this.stockList
serve.updateProduct(this.productDate).then(res=>{
uni.showToast({
title: res.msg,
icon: 'none'
})
uni.navigateTo({
url: `../productList/index`
})
})
}
}
}
</script>
<style lang="scss" scoped>
.fadeBox{
width: 100%;
margin-bottom: 20rpx;
}
#chooseType{
padding: 30rpx;
mulpicker{
height: 72rpx;
line-height: 72rpx;
@ -509,12 +561,12 @@
font-size: 28rpx;
font-weight: bold;
}
/deep/ .uni-forms-item{
width: 100%;
}
/deep/ .uni-forms-item__label{
color: #333 !important;
font-size: 30rpx;
@ -527,7 +579,7 @@
line-height: 72rpx;
}
}
switch{
margin-top: 9rpx;
}
@ -536,11 +588,11 @@
}
switch::after{
content: '';
}
}
}
#instruction{
padding: 30rpx;
mulpicker{
height: 72rpx;
line-height: 72rpx;
@ -551,7 +603,7 @@
/deep/ .uni-forms-item{
width: 100%;
}
/deep/ .uni-forms-item__label{
color: #333 !important;
font-size: 30rpx;
@ -627,9 +679,9 @@
z-index: 20;
}
}
}
.checkbox-con{
margin-top: 40rpx;
text-align: center;
@ -654,7 +706,7 @@
left: 50rpx;
}
}
.checked{
color: #FFFFFF;
background: #FE0606;
@ -663,16 +715,16 @@
.checkbox checkbox{
display: none
}
.buttons {
width: 100%;
display: flex;
justify-content: space-evenly;
margin-top: 180rpx;
>view {
width: 250rpx;
height: 76rpx;
@ -680,13 +732,13 @@
line-height: 76rpx;
border-radius: 10rpx;
font-size: 28rpx;
&:nth-of-type(1) {
background: #FFFFFF;
border: 1rpx solid #B6B6B6;
color: #333;
}
&:nth-of-type(2) {
background: #FE0505;
color: #fff;

Loading…
Cancel
Save