|
@@ -19,7 +19,23 @@
|
|
<text>{{xianshi?'修改':'保存'}}</text>
|
|
<text>{{xianshi?'修改':'保存'}}</text>
|
|
</view>
|
|
</view>
|
|
<view class="you black mt-30" v-if="alldata !=0">
|
|
<view class="you black mt-30" v-if="alldata !=0">
|
|
- <tm-input :disabled="xianshi" :required="true" title="商品名称" v-model="alldata.detail.goods_name" align="right"></tm-input>
|
|
|
|
|
|
+ <!-- <tm-pickers :default-value="selected" @confirm="xuanzeaa" :list="['苹果','香蕉','可口可乐','新西兰','日本']">
|
|
|
|
+ <tm-input title="嗷嗷" align="right" v-model="selected[0]" disabled right-icon="icon-angle-right"></tm-input>
|
|
|
|
+ </tm-pickers> -->
|
|
|
|
+ <view v-for="(item,index) in alldata.detail.parameter">
|
|
|
|
+ <tm-pickers :default-value="getshow(item)" :disabled="xianshi" class="tan" v-if="item.type=='select'" @confirm="xuanze" :indexfu="item.name" :list="item.value">
|
|
|
|
+ <tm-input :title="item.name" align="right" :placeholder="'请选择'+item.name" v-model="item.choosevalue" disabled right-icon="icon-angle-right"></tm-input>
|
|
|
|
+ </tm-pickers>
|
|
|
|
+ <tm-input :disabled="xianshi" v-if="item.type=='text' && item.name !='颜色'" :title="item.name" v-model="item.choosevalue" align="right"></tm-input>
|
|
|
|
+ <view class="border-b-0 border-grey-darken-4-b-1 py-24 flex-between" v-if="item.name=='颜色'">
|
|
|
|
+ <text class="text-size-n ">{{item.name}}</text>
|
|
|
|
+ <view>
|
|
|
|
+ <view class="seka" :style="{'backgroundColor':item.choosevalue}" @tap="showPickerColorPop"></view>
|
|
|
|
+ <picker-color :isShow="showPickerColor" :bottom="bottomPickerColor" @callback='getPickerColor' />
|
|
|
|
+ </view>
|
|
|
|
+ </view>
|
|
|
|
+ </view>
|
|
|
|
+ <!-- <tm-input :disabled="xianshi" :required="true" title="商品名称" v-model="alldata.detail.goods_name" align="right"></tm-input>
|
|
<tm-pickers :disabled="xianshi" class="tan" :default-value.sync="category_danarr" rang-key="category_name" :list="category_arr">
|
|
<tm-pickers :disabled="xianshi" class="tan" :default-value.sync="category_danarr" rang-key="category_name" :list="category_arr">
|
|
<tm-input :required="true" title="分类" placeholder="请选择分类" disabled :value="obTstr1(category_danarr,'category_name')" right-icon="icon-angle-right"></tm-input>
|
|
<tm-input :required="true" title="分类" placeholder="请选择分类" disabled :value="obTstr1(category_danarr,'category_name')" right-icon="icon-angle-right"></tm-input>
|
|
</tm-pickers>
|
|
</tm-pickers>
|
|
@@ -33,7 +49,7 @@
|
|
</tm-pickers>
|
|
</tm-pickers>
|
|
<tm-input :disabled="xianshi" title="适用人群" v-model="alldata.detail.type" align="right"></tm-input>
|
|
<tm-input :disabled="xianshi" title="适用人群" v-model="alldata.detail.type" align="right"></tm-input>
|
|
<tm-input :disabled="xianshi" title="品牌" v-model="alldata.detail.brand" align="right"></tm-input>
|
|
<tm-input :disabled="xianshi" title="品牌" v-model="alldata.detail.brand" align="right"></tm-input>
|
|
- <tm-input :disabled="xianshi" title="材料" v-model="alldata.detail.science" align="right"></tm-input>
|
|
|
|
|
|
+ <tm-input :disabled="xianshi" title="材料" v-model="alldata.detail.science" align="right"></tm-input> -->
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</tm-sheet>
|
|
</tm-sheet>
|
|
@@ -108,9 +124,18 @@
|
|
</template>
|
|
</template>
|
|
<script>
|
|
<script>
|
|
import{myRequest} from '@/api/request.js'
|
|
import{myRequest} from '@/api/request.js'
|
|
|
|
+import pickerColor from "@/components/helang-pickerColor/helang-pickerColor.vue"
|
|
export default {
|
|
export default {
|
|
|
|
+ components: {
|
|
|
|
+ "picker-color":pickerColor,
|
|
|
|
+ },
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
|
|
+ selected:['裤子'],
|
|
|
|
+ buttonColor:"#0099FF",
|
|
|
|
+ showPickerColor:false,
|
|
|
|
+ bottomPickerColor:0,
|
|
|
|
+ arrbig:[],
|
|
category_arr:[],
|
|
category_arr:[],
|
|
category_danarr:[],
|
|
category_danarr:[],
|
|
role_arr:[],
|
|
role_arr:[],
|
|
@@ -160,6 +185,42 @@ export default {
|
|
this.sys = uni.getSystemInfoSync();
|
|
this.sys = uni.getSystemInfoSync();
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ getshow(data){
|
|
|
|
+ return [data.choosevalue]
|
|
|
|
+ },
|
|
|
|
+ /* 显示获取颜色选择弹窗 */
|
|
|
|
+ showPickerColorPop(){
|
|
|
|
+ if(this.xianshi){
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ this.showPickerColor=true;
|
|
|
|
+ },
|
|
|
|
+ /* 获取颜色选择回调 */
|
|
|
|
+ getPickerColor(color){
|
|
|
|
+ /* 隐藏弹窗 */
|
|
|
|
+ this.showPickerColor=false;
|
|
|
|
+ /* 判断颜色值是否有效 */
|
|
|
|
+ if(color){
|
|
|
|
+ this.buttonColor=color;
|
|
|
|
+ var xunhuan=this.alldata.detail.parameter;
|
|
|
|
+ for(let i=0;i<xunhuan.length;i++){
|
|
|
|
+ if(xunhuan[i].name=="颜色"){
|
|
|
|
+ xunhuan[i].choosevalue=color
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ xuanzeaa(data){
|
|
|
|
+ console.log(data)
|
|
|
|
+ this.selected=[data[0].data]
|
|
|
|
+ },
|
|
|
|
+ xuanze(data){
|
|
|
|
+ for(let i=0;i<this.alldata.detail.parameter.length;i++){
|
|
|
|
+ if(this.alldata.detail.parameter[i].name==data[0].name){
|
|
|
|
+ this.alldata.detail.parameter[i].choosevalue=data[0].data
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },
|
|
quxchuFun(){
|
|
quxchuFun(){
|
|
var that=this;
|
|
var that=this;
|
|
console.log(that.chukudata[0].id)
|
|
console.log(that.chukudata[0].id)
|
|
@@ -285,6 +346,12 @@ export default {
|
|
}).then(res => {
|
|
}).then(res => {
|
|
if (res.data.code == 200) {
|
|
if (res.data.code == 200) {
|
|
that.alldata=res.data.data;
|
|
that.alldata=res.data.data;
|
|
|
|
+ // var xunhuan=that.alldata.detail.parameter;
|
|
|
|
+ // for(let i=0;i<xunhuan.length;i++){
|
|
|
|
+ // if(xunhuan[i].name=="颜色"){
|
|
|
|
+ // that.buttonColor="#"+xunhuan[i].choosevalue
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
that.getFl();
|
|
that.getFl();
|
|
that.getCY();
|
|
that.getCY();
|
|
}else{
|
|
}else{
|
|
@@ -317,38 +384,52 @@ export default {
|
|
xiugaiFun(){
|
|
xiugaiFun(){
|
|
var that=this;
|
|
var that=this;
|
|
if(! this.xianshi){
|
|
if(! this.xianshi){
|
|
- if(that.category_danarr.length==0){
|
|
|
|
- that.$refs.toast.show({model:'warn',label:'请选择分类'})
|
|
|
|
- return
|
|
|
|
- }else{
|
|
|
|
- that.reqData.category_id=that.category_danarr[0].id
|
|
|
|
|
|
+ var databaocun=that.alldata.detail.parameter;
|
|
|
|
+ console.log(databaocun)
|
|
|
|
+ for(let i=0;i<databaocun.length;i++){
|
|
|
|
+ if(databaocun[i].choosevalue==""){
|
|
|
|
+ that.$refs.toast.show({model:'warn',label:'请将数据填写完整'})
|
|
|
|
+ return
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- if(that.role_danarr.length==0){
|
|
|
|
- that.$refs.toast.show({model:'warn',label:'请选择成员'})
|
|
|
|
- return
|
|
|
|
- }else{
|
|
|
|
- that.reqData.role_id=that.role_danarr[0].id
|
|
|
|
|
|
+ // 分类id
|
|
|
|
+ for(let i=0;i<that.category_arr.length;i++){
|
|
|
|
+ if(that.category_arr[i].category_name==databaocun[0].choosevalue){
|
|
|
|
+ databaocun[0].classid=that.category_arr[i].id
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- if(that.size_danarr.length!=0){
|
|
|
|
- that.reqData.size=that.size_danarr[0].id
|
|
|
|
|
|
+ // // 成员id
|
|
|
|
+ for(let i=0;i<that.role_arr.length;i++){
|
|
|
|
+ if(that.role_arr[i].username==databaocun[1].choosevalue){
|
|
|
|
+ databaocun[1].memberid=that.role_arr[i].id
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- that.reqData.goods_name=that.alldata.detail.goods_name;
|
|
|
|
- if(that.reqData.goods_name==""){
|
|
|
|
- that.$refs.toast.show({model:'warn',label:'请输入商品名称'})
|
|
|
|
- return
|
|
|
|
|
|
+ // 去掉图片的头
|
|
|
|
+ var img=""
|
|
|
|
+ if(that.alldata.detail.image){
|
|
|
|
+ var oldimg=that.alldata.detail.image;
|
|
|
|
+ img=oldimg.substr(24)
|
|
}
|
|
}
|
|
- that.reqData.year=that.alldata.detail.year;
|
|
|
|
- that.reqData.color=that.alldata.detail.color;
|
|
|
|
- that.reqData.type=that.alldata.detail.type;
|
|
|
|
- that.reqData.brand=that.alldata.detail.brand;
|
|
|
|
- that.reqData.science=that.alldata.detail.science;
|
|
|
|
- that.reqData.id=that.alldata.detail.id;
|
|
|
|
myRequest({
|
|
myRequest({
|
|
url: "/api/Goods/updateGoods",
|
|
url: "/api/Goods/updateGoods",
|
|
method:'post',
|
|
method:'post',
|
|
- data:that.reqData
|
|
|
|
|
|
+ data:{
|
|
|
|
+ img:img,
|
|
|
|
+ id:that.alldata.detail.id,
|
|
|
|
+ parm:databaocun
|
|
|
|
+ }
|
|
}).then(res => {
|
|
}).then(res => {
|
|
if (res.data.code == 200) {
|
|
if (res.data.code == 200) {
|
|
|
|
+ setTimeout(function(){
|
|
|
|
+ let pages = getCurrentPages(); // 当前页面
|
|
|
|
+ let beforePage = pages[pages.length - 2]; // 前一个页面
|
|
|
|
+ uni.navigateBack({
|
|
|
|
+ delta: 1,
|
|
|
|
+ success: function() {
|
|
|
|
+ beforePage.$vm.shuaxin()
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },2000)
|
|
that.$refs.toast.show({model:'success',label:res.data.msg})
|
|
that.$refs.toast.show({model:'success',label:res.data.msg})
|
|
}else{
|
|
}else{
|
|
that.$refs.toast.show({model:'error',label:res.data.msg})
|
|
that.$refs.toast.show({model:'error',label:res.data.msg})
|
|
@@ -442,4 +523,5 @@ export default {
|
|
.yiguicla1{width: 47%;border-radius: 10px;}
|
|
.yiguicla1{width: 47%;border-radius: 10px;}
|
|
.more{text-align: center;}
|
|
.more{text-align: center;}
|
|
.more image{margin-right: 10px;vertical-align: middle;width: 30px;}
|
|
.more image{margin-right: 10px;vertical-align: middle;width: 30px;}
|
|
|
|
+ .seka{width: 40px;height: 20px;border:1px solid white;}
|
|
</style>
|
|
</style>
|