diff --git a/packageIntegral/productAddition/index.vue b/packageIntegral/productAddition/index.vue
index cd0fa06..320c023 100644
--- a/packageIntegral/productAddition/index.vue
+++ b/packageIntegral/productAddition/index.vue
@@ -38,7 +38,7 @@
-
+
@@ -68,7 +68,7 @@
>
- 商品类型:
+ 商品类型:
@@ -83,36 +83,37 @@
- 批量填充:批量填充填入信息后,可以批量将内容填写到SKU 信息里
- {{item.label}}
+ 批量填充:批量填充填入信息后,可以批量将内容填写到SKU 信息里
+ {{item.label}}
确定
-
-
+
+
*
规格:
- {{radioAttributes}}+{{items}}
+ {{radioAttributes}}
+ {{radioAttributes}}+{{checkboxAttributes[index]}}
-
-
+
+
- 删除
-
-
-
- *
- 规格:
- {{radioAttributes}}
+
+
+
+
+
-
-
+
+
- 删除
+ 删除
-
+
*
- 商品图片:最多可上传10张图片
+ 商品图片:
+ 最多可上传10张图片
+
@@ -121,12 +122,12 @@
- 设为主图
+ 设为主图
-
-
+
+
@@ -159,7 +160,7 @@
},
data() {
return {
- currentBoxId: 'instruction', //当前显示的view的id
+ currentBoxId: 'chooseType', //当前显示的view的id
isBoxShow: false,
productDate:{
images:[]
@@ -193,8 +194,7 @@
}
},
- onLoad(options) {
- // this.get(options.orderId)
+ onLoad() {
this.classfication()
this.getProductBrands()
this.getAttributesType()
@@ -208,6 +208,13 @@
}
},
methods: {
+ switchChange(e){
+ if(e.detail.value == true){
+ this.productDate.productStatus = '1'
+ }else if(e.detail.value == false){
+ this.productDate.productStatus = '2'
+ }
+ },
classfication(){
serve.classification().then(res=>{
this.productList = res.data
@@ -304,90 +311,43 @@
this.checkboxAttributes.splice(i,1)
this.radioAttributes = ''
}
+ this.stockList.splice(i,1)
},
deleteRadio(){
this.radioAttributes = ''
},
changeChecked(item){
-
item.checked = !item.checked
- console.log(this.radioAttributes,this.checkboxAttributes)
-
},
addStockList(){
this.stockList = []
- let obj = {}
- this.bottonList.forEach(tab=>{
- if(tab.checked == true){
- if(tab.value == 'marketPrice'){
- obj.marketPrice = ''
- }else if(tab.value == 'sellPrice'){
- obj.sellPrice = ''
- }else if(tab.value == 'stock'){
- obj.stock = ''
- }else if(tab.value == 'integral'){
- obj.integral = ''
- }
- }
- })
- this.stockList.push(obj)
+ let obj = {
+ marketPrice:'',
+ sellPrice:'',
+ stock:'',
+ integral:''
+ }
+ if(this.attributesList.length ==1){
+ let data = {}
+ let name = this.attributesList[0].attributeName
+ let value = this.radioAttributes
+ data[name] = value
+ obj.attributeJson = JSON.stringify(data)
+ this.stockList.push(obj)
+ }else{
+ this.checkboxAttributes.forEach((tab,index)=>{
+ let name = this.attributesList[0].attributeName
+ let value = this.radioAttributes
+ let tabName = this.attributesList[index+1].attributeName
+ let tabValue = tab
+ data[name] = value
+ data[tabName] = tabValue
+ obj.attributeJson = JSON.stringify(data)
+ this.stockList.push(obj)
+ })
+
+ }
},
- // 调用系统相机
- takePhoto() {
- // 先检查权限
- let _that = this
- uni.getSetting({
- success(res) {
- if (!res.authSetting['scope.camera']) {
- // 请求权限
- uni.authorize({
- scope: 'scope.camera',
- success() {
- // 权限已经获取,可以调用相机
- _that.srcFileImage()
- },
- fail() {
- // 用户拒绝授权,需引导用户开启权限
- uni.showModal({
- title: '提示',
- content: '需要相机权限才能使用相机功能,请在设置中打开',
- success: (modalRes) => {
- if (modalRes.confirm) {
- // 引导用户去设置中打开权限
- uni.openSetting({
- success(res) {
- if (res.authSetting['scope.camera']) {
- re()
- // 授权成功
- } else {
- // 没有允许相机权限
- wx.showToast({
- title: '您拒绝了相机权限,将无法使用相机功能',
- icon: 'none'
- });
- rj('拒绝了相机权限')
- }
- },
- fail() {
- rj('openSetting调用失败')
- }
- })
- }
- },
- });
- },
- });
- } else {
- // 权限已经获取,可以直接调用相机
- _that.srcFileImage()
- }
- },
- fail(err) {
- // 获取设置失败
- console.error(err);
- },
- });
- },
//调起上传图片
srcFileImage() {
let _that = this
@@ -447,6 +407,15 @@
})
}
},
+ setMainImage(index){
+ this.productDate.images.forEach((tab,i)=>{
+ if(i == index){
+ tab.mainMark = 1
+ }else{
+ tab.mainMark = ''
+ }
+ })
+ },
clearImage(index){
if(this.productDate.images[index].mainMark == 1){
this.productDate.images.splice(index,1)
@@ -455,17 +424,26 @@
this.productDate.images.splice(index,1)
}
},
- picker2(e){
- console.log(e.detail.value)
- this.productDate.value = e.detail.value
- },
closed(){
uni.navigateTo({
url: '/pages/index/index'
})
},
addCompleted(){
-
+ if(this.radioItem[0].checked =true){
+ this.productDate.newMark == '1'
+ }else{
+ this.productDate.newMark == '2'
+ }
+ if(this.radioItem[1].checked =true){
+ this.productDate.recommend == '1'
+ }else{
+ this.productDate.recommend == '2'
+ }
+ this.productDate.stockList = this.stockList
+ serve.saveProduct(this.productDate).then(res=>{
+ console.log(res)
+ })
}
}
}
@@ -549,7 +527,6 @@
.tagButton{
display: inline-block;
width: 133rpx;
- height: 58rpx;
background: #f5f5f5;
color: #666666;
border-radius: 8rpx;
@@ -584,6 +561,8 @@
display: inline-block;
width: 140rpx;
height: 140rpx;
+ vertical-align: middle;
+ text-align: center;
position: relative;
>image{
width: 100%;
diff --git a/packageIntegral/productList/index.vue b/packageIntegral/productList/index.vue
index 8ee4a14..e98ebdb 100644
--- a/packageIntegral/productList/index.vue
+++ b/packageIntegral/productList/index.vue
@@ -32,7 +32,7 @@
:style="{background:statusEnum[item.auditStatus].color}" >{{statusEnum[item.auditStatus].value}}
@@ -242,10 +242,9 @@
orderDelete(){
this.$refs.delete.open('center')
},
- editOrder(item){
- console.log(item)
+ toEditOrder(item){
uni.navigateTo({
- url: `../productUpdate/index??orderId=${item.id}`
+ url: `../productUpdate/index?id=${item.id}`
})
},
diff --git a/packageIntegral/productUpdate/index.vue b/packageIntegral/productUpdate/index.vue
index cd0fa06..5d9665e 100644
--- a/packageIntegral/productUpdate/index.vue
+++ b/packageIntegral/productUpdate/index.vue
@@ -38,7 +38,7 @@
-
+
@@ -68,7 +68,7 @@
>
- 商品类型:
+ 商品类型:
@@ -83,36 +83,37 @@
- 批量填充:批量填充填入信息后,可以批量将内容填写到SKU 信息里
- {{item.label}}
+ 批量填充:批量填充填入信息后,可以批量将内容填写到SKU 信息里
+ {{item.label}}
确定
-
-
+
+
*
规格:
- {{radioAttributes}}+{{items}}
+ {{radioAttributes}}
+ {{radioAttributes}}+{{checkboxAttributes[index]}}
-
-
+
+
- 删除
-
-
-
- *
- 规格:
- {{radioAttributes}}
+
+
+
+
+
-
-
+
+
- 删除
+ 删除
-
+
*
- 商品图片:最多可上传10张图片
+ 商品图片:
+ 最多可上传10张图片
+
@@ -121,12 +122,12 @@
- 设为主图
+ 设为主图
-
-
+
+
@@ -159,7 +160,7 @@
},
data() {
return {
- currentBoxId: 'instruction', //当前显示的view的id
+ currentBoxId: 'chooseType', //当前显示的view的id
isBoxShow: false,
productDate:{
images:[]
@@ -194,7 +195,8 @@
},
onLoad(options) {
- // this.get(options.orderId)
+ console.log(options,'options')
+ this.getEdit(options)
this.classfication()
this.getProductBrands()
this.getAttributesType()
@@ -208,6 +210,56 @@
}
},
methods: {
+ getEdit(options){
+ serve.getEdit(options.id).then(res=>{
+ if(res.code === 20000&&res.data!=null){
+ this.productDate = res.data
+ this.productDate.demandRegion = res.data.categoryOneId+','+res.data.categoryTwoId
+ if(this.productDate.newMark == '1'){
+ this.radioItem[0].checked =true
+ }else{
+ this.radioItem[0].checked =false
+ }
+ if(this.productDate.recommend == '1'){
+ this.radioItem[1].checked =true
+ }else{
+ this.radioItem[1].checked =false
+ }
+ this.attributesTypeList.forEach(tab=>{
+ if(tab.id = this.productDate.attributesTypeId){
+ this.attributesList = tab.attributesList
+ this.attributesList.forEach(tab=>{
+ tab.attributesList = []
+ tab.attributeContent.split(',').forEach(item=>{
+ tab.attributesList.push({value:item,text:item})
+ })
+ })
+ }
+ })
+ if(this.productDate.checkedList.length==1){
+ this.radioAttributes = this.productDate.checkedList[0].checked
+ }else{
+ this.checkboxAttributes = []
+ this.productDate.checkedList.forEach((tab,index)=>{
+ if(index!=0){
+ this.checkboxAttributes.push(tab.checked)
+ }
+ })
+ }
+ this.stockList = this.productDate.stockList
+
+
+ }
+ console.log(res.data)
+ })
+ },
+ switchChange(e){
+ if(e.detail.value == true){
+ this.productDate.productStatus = '1'
+ }else if(e.detail.value == false){
+ this.productDate.productStatus = '2'
+ }
+ },
classfication(){
serve.classification().then(res=>{
this.productList = res.data
@@ -304,90 +356,43 @@
this.checkboxAttributes.splice(i,1)
this.radioAttributes = ''
}
+ this.stockList.splice(i,1)
},
deleteRadio(){
this.radioAttributes = ''
},
changeChecked(item){
-
item.checked = !item.checked
- console.log(this.radioAttributes,this.checkboxAttributes)
-
},
addStockList(){
this.stockList = []
- let obj = {}
- this.bottonList.forEach(tab=>{
- if(tab.checked == true){
- if(tab.value == 'marketPrice'){
- obj.marketPrice = ''
- }else if(tab.value == 'sellPrice'){
- obj.sellPrice = ''
- }else if(tab.value == 'stock'){
- obj.stock = ''
- }else if(tab.value == 'integral'){
- obj.integral = ''
- }
- }
- })
- this.stockList.push(obj)
+ let obj = {
+ marketPrice:'',
+ sellPrice:'',
+ stock:'',
+ integral:''
+ }
+ if(this.attributesList.length ==1){
+ let data = {}
+ let name = this.attributesList[0].attributeName
+ let value = this.radioAttributes
+ data[name] = value
+ obj.attributeJson = JSON.stringify(data)
+ this.stockList.push(obj)
+ }else{
+ this.checkboxAttributes.forEach((tab,index)=>{
+ let name = this.attributesList[0].attributeName
+ let value = this.radioAttributes
+ let tabName = this.attributesList[index+1].attributeName
+ let tabValue = tab
+ data[name] = value
+ data[tabName] = tabValue
+ obj.attributeJson = JSON.stringify(data)
+ this.stockList.push(obj)
+ })
+
+ }
},
- // 调用系统相机
- takePhoto() {
- // 先检查权限
- let _that = this
- uni.getSetting({
- success(res) {
- if (!res.authSetting['scope.camera']) {
- // 请求权限
- uni.authorize({
- scope: 'scope.camera',
- success() {
- // 权限已经获取,可以调用相机
- _that.srcFileImage()
- },
- fail() {
- // 用户拒绝授权,需引导用户开启权限
- uni.showModal({
- title: '提示',
- content: '需要相机权限才能使用相机功能,请在设置中打开',
- success: (modalRes) => {
- if (modalRes.confirm) {
- // 引导用户去设置中打开权限
- uni.openSetting({
- success(res) {
- if (res.authSetting['scope.camera']) {
- re()
- // 授权成功
- } else {
- // 没有允许相机权限
- wx.showToast({
- title: '您拒绝了相机权限,将无法使用相机功能',
- icon: 'none'
- });
- rj('拒绝了相机权限')
- }
- },
- fail() {
- rj('openSetting调用失败')
- }
- })
- }
- },
- });
- },
- });
- } else {
- // 权限已经获取,可以直接调用相机
- _that.srcFileImage()
- }
- },
- fail(err) {
- // 获取设置失败
- console.error(err);
- },
- });
- },
//调起上传图片
srcFileImage() {
let _that = this
@@ -447,6 +452,15 @@
})
}
},
+ setMainImage(index){
+ this.productDate.images.forEach((tab,i)=>{
+ if(i == index){
+ tab.mainMark = 1
+ }else{
+ tab.mainMark = ''
+ }
+ })
+ },
clearImage(index){
if(this.productDate.images[index].mainMark == 1){
this.productDate.images.splice(index,1)
@@ -455,17 +469,21 @@
this.productDate.images.splice(index,1)
}
},
- picker2(e){
- console.log(e.detail.value)
- this.productDate.value = e.detail.value
- },
closed(){
- uni.navigateTo({
- url: '/pages/index/index'
- })
+ uni.navigateBack()
},
addCompleted(){
-
+ if(this.radioItem[0].checked =true){
+ this.productDate.newMark == '1'
+ }else{
+ this.productDate.newMark == '2'
+ }
+ if(this.radioItem[1].checked =true){
+ this.productDate.recommend == '1'
+ }else{
+ this.productDate.recommend == '2'
+ }
+ this.productDate.stockList = this.stockList
}
}
}
@@ -549,7 +567,6 @@
.tagButton{
display: inline-block;
width: 133rpx;
- height: 58rpx;
background: #f5f5f5;
color: #666666;
border-radius: 8rpx;
@@ -584,6 +601,8 @@
display: inline-block;
width: 140rpx;
height: 140rpx;
+ vertical-align: middle;
+ text-align: center;
position: relative;
>image{
width: 100%;
diff --git a/pages.json b/pages.json
index cf9ca96..5a51986 100644
--- a/pages.json
+++ b/pages.json
@@ -103,6 +103,9 @@
},{
"path": "productAddition/index",
"style": {}
+ },{
+ "path": "productUpdate/index",
+ "style": {}
}]
},
{