<template>
	<view class="page" :style="themeColor">
		<view class="flex benben-position-layout flex flex-wrap align-center addProduct_flex_0"
			:style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx'}">
			<view class='flex flex-wrap align-center justify-between flex-sub addProduct_fd0_0'>
				<view class='flex flex-wrap align-center' @tap.stop="handleJumpDiy" data-type="back" data-url="1">
					<text class='fu-iconfont2  addProduct_fd0_0_c0_c0' @tap.stop="handleJumpDiy" data-type="back"
						data-url="1">&#xE794;</text>
				</view>
				<view class='flex flex-wrap align-stretch justify-center flex-sub'>
					<text class='addProduct_fd0_0_c1_c0'>添加商品</text>
				</view>
				<view class='flex flex-wrap align-center addProduct_fd0_0_c2'>
				</view>
			</view>

		</view>
		<view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
		<!---flex布局flex布局开始-->
		<view class="flex flex-direction flex-wrap align-stretch benben-flex-layout addProduct_flex_1">
			<view class='flex flex-direction flex-wrap align-stretch'>
				<view class='flex flex-wrap align-center'>
					<text class='addProduct_fd1_0_c0_c0'>商品名称</text>
				</view>
				<view class='flex flex-wrap align-center addProduct_fd1_0_c1'>
					<view class='flex-wrap flex addProduct_fd1_0_c1_c0'>
						<textarea class='addProduct_input_fd1_0_c1_c0' confirm-type="done"
							:placeholder="'请输入商品标题，如商品品牌+名字+重量大小等'" :maxlength="30" :show-num='true'
							placeholder-style="color:rgba(181, 181, 181, 1);font-size:28rpx" v-model="commodity_name" />
						<template>
							<view class='flex flex justify-end addProduct_numberfd1_0_c1_c0_c0'>
								<text>{{commodity_name.length}}</text>
								<text>/</text>
								<text>30</text>
							</view>
						</template>
					</view>
				</view>
			</view>
			<view class='flex flex-direction flex-wrap align-stretch addProduct_fd1_1'>
				<view class='flex flex-wrap align-center'>
					<text class='addProduct_fd1_1_c0_c0'>商品详情</text>
				</view>
				<view class='flex flex-wrap align-center addProduct_fd1_1_c1'>
					<view class='flex-wrap flex addProduct_fd1_1_c1_c0'>
						<textarea class='addProduct_input_fd1_1_c1_c0' confirm-type="done" :placeholder="'请输入商品详情'"
							:maxlength="300" :show-num='true'
							placeholder-style="color:rgba(181, 181, 181, 1);font-size:28rpx"
							v-model="commodity_details" />
						<template>
							<view class='flex flex justify-end addProduct_numberfd1_1_c1_c0_c0'>
								<text>{{commodity_details.length}}</text>
								<text>/</text>
								<text>300</text>
							</view>
						</template>
					</view>
				</view>
			</view>
			<view class='flex flex-direction flex-wrap align-stretch addProduct_fd1_2'>
				<view class='flex flex-wrap align-center justify-between addProduct_fd1_2_c0'
					@tap.stop="goodsClass">
					<view class='flex flex-wrap align-center'>
						<text class='addProduct_fd1_2_c0_c0_c0'>商品分类</text>
					</view>
					<view class='flex flex-wrap align-center'>
						<input class='addProduct_fd1_2_c0_c1_c0' type="text" placeholder="请选择" confirm-type="done"
							:maxlength="-1" :disabled='true'
							placeholder-style="color:rgba(181, 181, 181, 1);font-size:28rpx"
							v-model="classification_name" />
						<image class='addProduct_fd1_2_c0_c1_c1' mode="aspectFit" :src='STATIC_URL+"29.png"'></image>
					</view>
				</view>
				<view class='flex flex-wrap align-center justify-between addProduct_fd1_2_c1'>
					<view class='flex flex-wrap align-center'>
						<text class='addProduct_fd1_2_c1_c0_c0'>是否多规格</text>
					</view>
					<view class='flex flex-wrap align-center'>
						<image class='addProduct_fd1_2_c1_c1_c0' :src='STATIC_URL+"88.png"'
							@tap.stop="multiplesPecificationsFunc()" v-if="specifications=='1'"></image>
						<image class='addProduct_fd1_2_c1_c1_c0_1' :src='STATIC_URL+"91.png"'
							@tap.stop="multiplesPecificationsFunc()" v-if="specifications=='0'"></image>
					</view>
				</view>
				<view @tap="descTap" class='flex flex-wrap align-center justify-between addProduct_fd1_2_c2' v-if="specifications==1">
					<view class='flex flex-wrap align-center'>
						<text class='addProduct_fd1_2_c2_c0_c0'>商品规格</text>
					</view>
					<view class='flex flex-wrap align-center'>
						<input class='addProduct_fd1_2_c2_c1_c0' type="text" placeholder="请选择" confirm-type="done"
							:maxlength="-1" :disabled='true'
							placeholder-style="color:rgba(181, 181, 181, 1);font-size:28rpx" v-model="fd1_2_c2_c1_c0" />
						<image class='addProduct_fd1_2_c2_c1_c1' mode="aspectFit" :src='STATIC_URL+"29.png"'></image>
					</view>
				</view>
			</view>
			<view class='flex flex-direction flex-wrap align-stretch addProduct_fd1_3'>
				<view class='flex flex-wrap align-center justify-between addProduct_fd1_3_c0' v-if="specifications!=1">
					<view class='flex flex-wrap align-center'>
						<text class='addProduct_fd1_3_c0_c0_c0'>商品价格</text>
					</view>
					<view class='flex flex-wrap align-center'>
						<input class='addProduct_fd1_3_c0_c1_c0' type="digit" placeholder="请输入商品价格" confirm-type="done"
							:maxlength="-1" placeholder-style="color:rgba(181, 181, 181, 1);font-size:28rpx"
							v-model="price" @input="handleInputMoney($event, 'price')" />
						<image class='addProduct_fd1_3_c0_c1_c1' mode="aspectFit" :src='STATIC_URL+"89.png"'></image>
					</view>
				</view>
				<view class='flex flex-wrap align-center justify-between addProduct_fd1_3_c1' v-if="specifications!=1">
					<view class='flex flex-wrap align-center'>
						<text class='addProduct_fd1_3_c1_c0_c0'>商品划线价</text>
					</view>
					<view class='flex flex-wrap align-center'>
						<input class='addProduct_fd1_3_c1_c1_c0' type="digit" placeholder="请输入商品划线价"
							confirm-type="done" :maxlength="-1"
							placeholder-style="color:rgba(181, 181, 181, 1);font-size:28rpx" v-model="crossedprice" @input="handleInputMoney($event, 'crossedprice')" />
						<image class='addProduct_fd1_3_c1_c1_c1' mode="aspectFit" :src='STATIC_URL+"89.png"'></image>
					</view>
				</view>
				<view class='flex flex-wrap align-center justify-between addProduct_fd1_3_c2'>
					<view class='flex flex-wrap align-center'>
						<text class='addProduct_fd1_3_c2_c0_c0'>打包费</text>
					</view>
					<view class='flex flex-wrap align-center'>
						<input class='addProduct_fd1_3_c2_c1_c0' type="digit" placeholder="请输入" confirm-type="done"
							:maxlength="-1" placeholder-style="color:rgba(181, 181, 181, 1);font-size:28rpx"
							v-model="packingcharge" @input="handleInputMoney($event, 'packingcharge')" />
						<image class='addProduct_fd1_3_c2_c1_c1' mode="aspectFit" :src='STATIC_URL+"89.png"'></image>
					</view>
				</view>
			</view>
			<view class='flex flex-direction flex-wrap align-stretch addProduct_fd1_4'>
				<view class='flex flex-wrap align-center justify-between addProduct_fd1_4_c0'>
					<view class='flex flex-wrap align-center'>
						<text class='addProduct_fd1_4_c0_c0_c0'>热销商品</text>
					</view>
					<view class='flex flex-wrap align-center' @tap="hotTap">
						<image class='addProduct_fd1_4_c0_c1_c0' :src='STATIC_URL+"88.png"' v-if="hotsales=='1'">
						</image>
						<image class='addProduct_fd1_4_c0_c1_c0_1' :src='STATIC_URL+"91.png"' v-if="hotsales=='0'">
						</image>
					</view>
				</view>
				<view class='flex flex-wrap align-center justify-between addProduct_fd1_4_c1'>
					<view class='flex flex-wrap align-center'>
						<text class='addProduct_fd1_4_c1_c0_c0'>是否上架</text>
					</view>
					<view class='flex flex-wrap align-center' @tap="groundingTap">
						<image class='addProduct_fd1_4_c1_c1_c0' :src='STATIC_URL+"88.png"' v-if="isgrounding=='1'">
						</image>
						<image class='addProduct_fd1_4_c1_c1_c0_1' :src='STATIC_URL+"91.png"' v-if="isgrounding=='0'">
						</image>
					</view>
				</view>
				<view class='flex flex-wrap align-center justify-between addProduct_fd1_4_c2'>
					<view class='flex flex-wrap align-center'>
						<text class='addProduct_fd1_4_c2_c0_c0'>必选商品</text>
					</view>
					<view class='flex flex-wrap align-center'>
						<benben-flex-switch-new class-name='flex flex' v-model="is_ticke" :disabled='false'
							:auto='true'>
							<template v-slot:checked>

								<view class='flex flex position-relative align-center'>
									<image class='addProduct_checkfd1_4_c2_c1_c0_c0_c0' mode="aspectFit"
										:src='STATIC_URL+"118.png"'></image>
								</view>

							</template>
							<template v-slot:unchecked>

								<view class='flex flex position-relative justify-end align-center'>
									<image class='addProduct_noCheckfd1_4_c2_c1_c0_c1_c0' mode="aspectFit"
										:src='STATIC_URL+"117.png"'></image>
								</view>

							</template>
						</benben-flex-switch-new>
					</view>
				</view>
			</view>
			<view class='flex flex-direction flex-wrap align-stretch addProduct_fd1_5'>
				<view class='flex flex-wrap align-center'>
					<text class='addProduct_fd1_5_c0_c0'>商品主图</text>
					<text class='addProduct_fd1_5_c0_c1'>{{mainimage?1:0}}/1</text>
					<text class='addProduct_fd1_6_c0_c4'>(请上传尺寸为375*375像素的图片)</text>
				</view>
				<view class='flex flex-wrap align-center addProduct_fd1_5_c1' @tap.stop="chooseImg('mainimage')">
					<view class="upload position-relative">
						<text v-if="mainimage != ''" @tap.stop="mainimage = ''"
							class='fu-iconfont2 position-absolute addProduct_fd1_5_c1_c0_icon'>&#xE8E7;</text>
						<image class=" addProduct_fd1_5_c1_c0_image" mode="aspectFill"
							:src="mainimage ? mainimage : STATIC_URL+'90.png'"></image>
					</view>
				</view>
			</view>
			<view class='flex flex-direction flex-wrap align-stretch addProduct_fd1_6'>
				<view class='flex flex-wrap align-center'>
					<text class='addProduct_fd1_6_c0_c0'>商品轮播图</text>
					<text class='addProduct_fd1_6_c0_c1'>{{chart_list.length}}</text>
					<text class='addProduct_fd1_6_c0_c2'>/</text>
					<text class='addProduct_fd1_6_c0_c3'>5</text>
					<text class='addProduct_fd1_6_c0_c4'>(请上传尺寸为375*375像素的图片)</text>
				</view>
				<view class='flex flex-wrap align-center' @tap.stop="chooseImg('lunimg')">
					<benben-images-upload ref="benbenImagesUploadfd1_6_c1_c0" :img-list.sync="chart_list"
						:img-ids.sync="chart_id" :maxlength="5">
						<template #content="{ num, maxlength, isShow, imgList }">
							<view class="flex flex-wrap align-start flex addProduct_fd1_6_c1_c0">

								<view v-for="(image, index) in imgList" :key="index"
									class='flex position-relative addProduct_fd1_6_c1_c00'>
									<text class='fu-iconfont2 position-absolute addProduct_fd1_6_c1_c000'
										@tap.stop="delImage(index)">&#xE8E7;</text>
									<image class='addProduct_fd1_6_c1_c001'
										@tap.stop="$refs.benbenImagesUploadfd1_6_c1_c0.previewImage(index)"
										mode="aspectFill" :src='image'></image>
								</view>

								<image class='addProduct_fd1_6_c1_c01' v-if="isShow"
									mode="aspectFit" :src='STATIC_URL+"90.png"'></image>

							</view>
						</template>
					</benben-images-upload>
				</view>
			</view>
		</view>

		<!---flex布局flex布局结束-->
		<benben-popup v-model="popupShow1684309788864" :mask="true" mode='center'>
			<!---删除商品flex布局开始-->
			<view class="flex flex-direction flex-wrap align-center addProduct_flex_2"
				@tap.stop="popupShow1650940432200=true">
				<text class='addProduct_fd2_0'>提示</text>
				<text class='addProduct_fd2_1'>确定删除当前商品？</text>
				<view class='flex flex-wrap align-center addProduct_fd2_2'>
					<button class='addProduct_fd2_2_c0' @tap.stop="popupShow1684309788864=false">取消</button>
					<button class='addProduct_fd2_2_c1' @tap="delTap">确定</button>
				</view>
			</view>

			<!---删除商品flex布局结束-->

		</benben-popup>
		<view class="flex flex-direction align-stretch benben-position-layout flex addProduct_flex_3">
			<view class='flex flex-wrap align-center addProduct_fd3_0' v-if="!id" @tap="sureTap">
				<button class='flex-sub addProduct_fd3_0_c0'>确定</button>
			</view>
			<view class='flex flex-wrap align-center justify-between addProduct_fd3_1' v-if="id">
				<button class='addProduct_fd3_1_c0' @tap.stop="popupShow1684309788864=true">删除</button>
				<button class='addProduct_fd3_1_c1' @tap="sureTap">保存</button>
			</view>

		</view>
		<view :style="{height: '128rpx'}"></view>
		<!--选择商品分类开始 -->
		<benben-picker ref="benbenWritePickerCodepicker4" :visible.sync="pickerDiy1684307484925"
			:label.sync='classification_id' :options='classification_type' @change="changeTap" mode='selector' :mask-show='true'
			:timeout='true' :picker-height='88' default-type='value' :default-props='{"label":"name","value":"aid"}'>
			<template #picker-header>
				<view class='flex flex-wrap align-center justify-between addProduct_picker4_0'>
					<text @tap="$refs.benbenWritePickerCodepicker4.cancel()">取消</text>
					<text>选择商品分类</text>
					<text class='addProduct_picker4_0_c2'
						@tap="$refs.benbenWritePickerCodepicker4.pickerConfirm()">确认</text>
				</view>
			</template>
		</benben-picker>
		<!--选择商品分类结束 -->
		<benben-popup v-model="popupShow1684377995101" :mask="true" mode='bottom'>
			<!---图片弹框flex布局开始-->
			<view class="flex flex-direction align-stretch benben-flex-layout addProduct_flex_5">
				<view class='flex align-center justify-between addProduct_fd5_0'>
					<view class='flex flex-wrap align-center addProduct_fd5_0_c0'>
					</view>
					<view class='flex flex-wrap align-center'>
						<text class='addProduct_fd5_0_c1_c0'>请选择</text>
					</view>
					<view class='flex flex-wrap align-center' @tap.stop="popupShow1684377995101=false">
						<image class='addProduct_fd5_0_c2_c0' mode="aspectFit" :src='STATIC_URL+"2.png"'></image>
					</view>
				</view>
				<view class='flex align-center justify-between addProduct_fd5_1'>
					<view class='flex flex-direction align-center' @tap.stop="galleryPage">
						<image class='addProduct_fd5_1_c0_c0' mode="aspectFit" :src='STATIC_URL+"95.png"'></image>
						<text class='addProduct_fd5_1_c0_c1'>图库</text>
					</view>
					<view @tap.stop="soloChooseImage('mainimage','mainimage',false,false)" class='flex flex-direction align-center' v-if="imagetype == 'mainimage'">
						<image class='addProduct_fd5_1_c1_c0' mode="aspectFit" :src='STATIC_URL+"96.png"'></image>
						<text class='addProduct_fd5_1_c1_c1'>相册选择</text>
					</view>
					<view class='flex flex-direction align-center' @tap.stop="soloChooseImage('lunimg','lunimg',false,false)" v-if="imagetype == 'lunimg'">
						<image class='addProduct_fd5_1_c1_c0' mode="aspectFit" :src='STATIC_URL+"96.png"'></image>
						<text class='addProduct_fd5_1_c1_c1'>相册选择</text>
					</view>
					
				</view>
			</view>

			<!---图片弹框flex布局结束-->

		</benben-popup>


	</view>
</template>
<script>
	import {validate} from '@/common/utils/validate.js'
	import UploadImage from '@/common/utils/upload-image.js'
	export default {
		components: {},


		data() {
			return {
				"popupShow1684377995101": false,
				"pickerDiy1684307484925": false,
				"popupShow1684309788864": false,
				"fd1_2_c2_c1_c0": "",
				"commodity_name": "", //商品名称
				"commodity_details": "",  //商品详情
				"classification_id": "",
				"classification_type": [],
				classification_name:"",
				"is_ticke": false, //是否必须
				"price": "",
				"crossedprice": "", //划线价
				"packingcharge": "",
				"specifications": "0", //是否多规格
				"hotsales": "0", //是否热销
				"isgrounding": "0",
				"mainimage": "", //主图
				"chart_list": [], //轮播图
				"chart_id": "",
				"id": "",
				imagetype:"" ,//主图还是轮播图
				imagesids:""  ,//轮播图id
				imagesidslist:[],
				spectypeid:"",
				attr_spce:""
			};
		},
		computed: {
			themeColor() {
				return this.$store.getters.themeColor
			},

		},
		watch: {},
		onLoad(options) {
			let {id,state} = options
			if (id !== undefined) this.id = id
			if(this.id){
				this.post6486d565ebaf7()
			}
			
			uni.$on('ADDIMG',res=>{
				console.log(res)
				this.popupShow1684377995101=false
				let img=JSON.parse(res.image)
				if(res.type == "lunimg"){
					this.imagesidslist = [...this.imagesidslist,...res.aid]
					this.chart_list.push(...img)
				}else{
					this.mainimage = img[0]
				}
				
			})
			global.GOODS_SKU_DATA = null
			uni.$on('ADD_GOODS_SPEC', res => {
			  console.log(res)
			  this.attr_spce = res.spec_list;
			  this.spectypeid = res.typeid;
			  global.GOODS_SKU_DATA = res.spec_list
			  global.GOODS_SKU_LIST = res.spec_attr
			  this.fd1_2_c2_c1_c0 = "已选择"
			})
		},
		onUnload() {

		},
		onShow() {
			this.goodsCategoryFind()
		},
		methods: {
			handleInputMoney(e, name) {
			  console.log(e);
			  console.log(name);
			  // let change_money = this.money;
			  let change_money = e.detail.value;
			  change_money = change_money.replace(/[^\d.]/g, ""); //清除“数字”和“.”以外的字符
			  change_money = change_money.replace(/\.{2,}/g, "."); //只保留第一个. 清除多余的
			  change_money = change_money.replace(".", "$#$").replace(/\./g, "").replace("$#$", ".");
			  change_money = change_money.replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3'); //只能输入两个小数
			  if (change_money.indexOf(".") < 0 && change_money != "") { //以上已经过滤，此处控制的是如果没有小数点，首位不能为类似于 01、02的金额
			    change_money = parseFloat(change_money);
			  } else if (change_money.indexOf(".") == 0) { //首为小数点，补全
			    if (change_money.length > 1) {
			      change_money = `0${change_money}`
			    } else {
			      change_money = change_money.replace(/[^$#$]/g, "0.");
			      change_money = change_money.replace(/\.{2,}/g, ".");
			    }
			
			  }
			  setTimeout(() => {//这个一定要定时器
			     this[name] = change_money
			  }, 50)
			},
			post6486d565ebaf7(){
				this.$api.post(global.apiUrls.post6486d565ebaf7,{
					id:this.id
				}).then(res => {
					if (res.data.code == 1) {
						let data = res.data.data
						this.commodity_name = data.name
						this.classification_id = data.cid
						this.classification_name = data.c_name
						this.mainimage = data.thumb
						this.imagesidslist = data.images.split(',')
						console.log(this.imagesidslist)
						this.chart_list = data.images_path
						this.commodity_details = data.body
						this.hotsales = data.is_hot
						this.is_ticke = data.is_required?1:false
						this.isgrounding = data.is_sale
						this.specifications = data.is_spec
						this.crossedprice = data.market_price
						this.packingcharge = data.packing_price
						this.price = data.shop_price
						this.spectypeid = data.spectypeid
						if (data.is_spec == 1) {
						  this.attr_spce = data.sku_list;
						  global.GOODS_SKU_DATA = data.sku_list
						  global.GOODS_SKU_LIST = data.spec_list
						  this.fd1_2_c2_c1_c0 = "已选择"
						} else {
						  global.GOODS_SKU_DATA = null
						  global.GOODS_SKU_LIST = null
						}
					}
				})
			},
			
			goodsCategoryFind() {
				this.$api.post(global.apiUrls.post6487d63dc3e21).then(res => {
					if (res.data.code == 1) {
						this.classification_type = res.data.data
					}
				})
			},
			goodsClass(){
				if(this.classification_type.length>0){
					this.pickerDiy1684307484925 = true
				}else{
					uni.navigateTo({
						url:"/pages/spgl/commodityManagement/commodityManagement"
					})
				}
			},
			changeTap(e){
				console.log(e)
				this.classification_name = e.result
				this.classification_id = e.value
			},
			//热卖切换
			hotTap(){
				this.hotsales = this.hotsales ==1?0:1
			},
			//是否上架
			groundingTap(){
				this.isgrounding = this.isgrounding ==1?0:1
			},
			//图片弹出
			chooseImg(type){
				this.imagetype = type
				this.popupShow1684377995101 = true
			},
			galleryPage(){
				let count=""
				if(this.imagetype == 'mainimage'){
					count = 1
				}else{
					count = parseInt(5) - parseInt(this.chart_list.length)
				}
				uni.navigateTo({
					url:"/pages/spgl/galleryPage/galleryPage?name=" + this.imagetype + '&count=' + count
				})
			},
			delImage(index){
				console.log(index)
				this.chart_list.splice(index, 1)
				this.imagesidslist.splice(index, 1)
			},
			//提交
			sureTap(){
				
				if(!this.commodity_name) return this.$message.info('请输入商品名称')
				if(!this.commodity_details) return this.$message.info('请输入商品详情')
				if(!this.classification_id) return this.$message.info('请选择商品分类')
				let attr_list = ""
				if (this.specifications == 1) {
				  if (!this.attr_spce) return this.$message.info('请选择商品规格')
				  attr_list=JSON.stringify(this.attr_spce)
				}else{
					if (!validate(this.price, 'ismoney')) return this.$message.info('请正确输入商品价格');
					if (!validate(this.crossedprice, 'ismoney')) return this.$message.info("请正确输入商品划线价格");
					
					if(parseFloat(this.crossedprice) < parseFloat(this.price)) return this.$message.info("商品划线价格要大于商品价格");
					
					
				}
				
				if(!this.mainimage) return this.$message.info('请上传商品主图')
				if(this.chart_list.length<=0) return this.$message.info('请上传商品轮播图')
				this.imagesids = this.chart_list.join(',')
				console.log(this.imagesids)
				let data = {
					goods_id:this.id,
					name:this.commodity_name,
					cid:this.classification_id,
					thumb:this.mainimage,
					images:this.imagesids,
					body:this.commodity_details,
					is_hot:this.hotsales,
					is_required:this.is_ticke?1:0,
					is_sale:this.isgrounding,
					is_spec:this.specifications,
					market_price:this.crossedprice,
					packing_price:this.packingcharge,
					shop_price:this.price,
					attr_list:attr_list,
					spectypeid:this.spectypeid
				}
				console.log(data)
				this.$api.post(global.apiUrls.post6486d8abe5e20,data).then(res=>{
					this.$message.info(res.data.msg)
					if(res.data.code==1){
						uni.navigateBack()
					}
				})
			},
			//删除商品
			delTap(){
				this.$api.post(global.apiUrls.post6486d74a10d1c,{
					id:this.id
				}).then(res => {
					this.$message.info(res.data.msg)
					if (res.data.code == 1) {
						uni.navigateBack()
					}
				})
			},
			descTap(){
				
				if(!this.commodity_name) return this.$message.info('请输入商品名称')
				uni.navigateTo({
					url:"/pages/spgl/productSpecifications/productSpecifications?name="+this.commodity_name+'&spectypeid='+this.spectypeid
				})
			},
			
			//上传单图、多图方法
			soloChooseImage(id, path, obj, obj1, fnName = false) {
				let self = this
				if (!obj) obj = this
				if (!obj1) obj1 = this
				if (self.uploading) {
					return
				}
				// 从相册中选择图片
				uni.chooseImage({
					count: 1, // 默认3
					sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图，默认二者都有
					success: function(res) {
						self.uploading = true
						// 开始上传
						new UploadImage(res.tempFiles, {
							complete: function(res) {
								console.log(res)
								self.uploading = false
								self.popupShow1684377995101 = false
								if(id=="lunimg"){
									self.chart_list.push(res[0].path)
									self.imagesidslist.push(res[0].id)
									
								}else{
									if (id) self.$set(obj, id, res[0].id)
									if (path) self.$set(obj1, path, res[0].path)
									if (fnName) self[fnName]()
								}
								
								
								self.post648826ea7189c(res[0].path)
							},
						})
					},
				})
			},
			 //图库上传照片
			post648826ea7189c(path){
				this.$api.post(global.apiUrls.post648826ea7189c,{
					image:path,
					name:this.commodity_name
				}).then(res=>{
					if(res.data.code==1){
						
					}
				})
			},
			//是否多规格
			multiplesPecificationsFunc() {
				if (this.specifications == '1') {
					this.specifications = '0';
					return
				} else if (this.specifications == '0') {
					this.specifications = '1';
					return
				}
			}
		}
	};
</script>
<style lang="scss" scoped>
	.page {
		width: 100vw;
		overflow-x: hidden;
		min-height: calc(100vh - var(--window-bottom));
		background: rgba(248, 248, 248, 1);
		background-size: 100% auto !important;
	}

	.addProduct_flex_0 {
		background: #fff;
		width: 750rpx;
		height: 88rpx;
		overflow: hidden;
		z-index: 10;
		top: 0rpx;
		background-size: 100% auto !important;
	}

	.addProduct_fd0_0_c2 {
		width: 32rpx;
		height: 32rpx;
	}

	.addProduct_fd0_0_c1_c0 {
		font-size: 36rpx;
		font-weight: 500;
		color: #333;
		line-height: 88rpx;
	}

	.addProduct_fd0_0_c0_c0 {
		font-size: 32rpx;
		font-weight: 500;
		color: #333;
		line-height: 88rpx;
	}

	.addProduct_fd0_0 {
		margin: 0rpx 32rpx 0rpx 32rpx;
	}

	.addProduct_flex_1 {
		padding: 24rpx 24rpx 30rpx 24rpx;
	}

	.addProduct_fd1_6_c1_c01 {
		width: 180rpx;
		height: 180rpx;
		margin: 0rpx 24rpx 24rpx 0rpx;
	}

	.addProduct_fd1_6_c1_c001 {
		width: 180rpx;
		height: 180rpx;
	}

	.addProduct_fd1_6_c1_c000 {
		top: 0rpx;
		right: 0rpx;
		z-index: 10;
		color: #ff5536;
	}

	.addProduct_fd1_6_c1_c00 {
		margin: 0rpx 24rpx 24rpx 0rpx;
	}

	.addProduct_fd1_6_c1_c0 {
		margin: 32rpx 0rpx 0rpx 0rpx;
	}

	.addProduct_fd1_6_c0_c4 {
		color: #999999;
		font-size: 24rpx;
		font-weight: 400;
		line-height: 38rpx;
		margin: 0rpx 0rpx 0rpx 16rpx;
	}

	.addProduct_fd1_6_c0_c3 {
		color: #0E0E0C;
		font-size: 24rpx;
		font-weight: 400;
		line-height: 38rpx;
	}

	.addProduct_fd1_6_c0_c2 {
		color: #0E0E0C;
		font-size: 24rpx;
		font-weight: 400;
		line-height: 38rpx;
	}

	.addProduct_fd1_6_c0_c1 {
		color: #0E0E0C;
		font-size: 24rpx;
		font-weight: 400;
		line-height: 38rpx;
	}

	.addProduct_fd1_6_c0_c0 {
		margin: 0rpx 16rpx 0rpx 0rpx;
		color: #0E0E0C;
		font-size: 28rpx;
		font-weight: 500;
		line-height: 38rpx;
	}

	.addProduct_fd1_6 {
		margin: 40rpx 0rpx 0rpx 0rpx;
	}

	.addProduct_fd1_5_c1_c0_image {
		background: rgba(238, 238, 238, 1);
		width: 180rpx;
		height: 180rpx;
		background-size: 100% auto !important;
		border-radius: 16rpx;
	}

	.addProduct_fd1_5_c1_c0_icon {
		top: 0rpx;
		right: 0rpx;
		z-index: 10;
		color: #ff5536;
	}

	.addProduct_fd1_5_c1 {
		margin: 32rpx 0rpx 0rpx 0rpx;
	}

	.addProduct_fd1_5_c0_c1 {
		color: #0E0E0C;
		font-size: 24rpx;
		font-weight: 400;
		line-height: 24rpx;
		margin: 0rpx 0rpx 0rpx 13rpx;
	}

	.addProduct_fd1_5_c0_c0 {
		color: #0E0E0C;
		font-size: 28rpx;
		font-weight: 500;
		line-height: 38rpx;
	}

	.addProduct_fd1_5 {
		margin: 40rpx 0rpx 0rpx 0rpx;
	}

	.addProduct_noCheckfd1_4_c2_c1_c0_c1_c0 {
		border-radius: 24rpx 24rpx 24rpx 24rpx;
		width: 36rpx;
		height: 36rpx;
	}

	.addProduct_checkfd1_4_c2_c1_c0_c0_c0 {
		width: 36rpx;
		height: 36rpx;
		border-radius: 24rpx 24rpx 24rpx 24rpx;
	}

	.addProduct_fd1_4_c2_c0_c0 {
		color: #333333;
		font-size: 28rpx;
		font-weight: 400;
		line-height: 30rpx;
	}

	.addProduct_fd1_4_c2 {
		border-bottom: 1px solid #eee;
		padding: 28rpx 0rpx 28rpx 0rpx;
	}

	.addProduct_fd1_4_c1_c1_c0_1 {
		width: 72rpx;
		height: 32rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
	}

	.addProduct_fd1_4_c1_c1_c0 {
		width: 72rpx;
		height: 32rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
	}

	.addProduct_fd1_4_c1_c0_c0 {
		color: #333333;
		font-size: 28rpx;
		font-weight: 400;
		line-height: 30rpx;
	}

	.addProduct_fd1_4_c1 {
		border-bottom: 1px solid #eee;
		padding: 28rpx 0rpx 28rpx 0rpx;
	}

	.addProduct_fd1_4_c0_c1_c0_1 {
		width: 72rpx;
		height: 32rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
	}

	.addProduct_fd1_4_c0_c1_c0 {
		width: 72rpx;
		height: 32rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
	}

	.addProduct_fd1_4_c0_c0_c0 {
		color: #333333;
		font-size: 28rpx;
		font-weight: 400;
		line-height: 30rpx;
	}

	.addProduct_fd1_4_c0 {
		border-bottom: 1px solid #eee;
		padding: 28rpx 0rpx 28rpx 0rpx;
	}

	.addProduct_fd1_4 {
		background: rgba(255, 255, 255, 1);
		margin: 24rpx 0rpx 0rpx 0rpx;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
		background-size: 100% auto !important;
		padding: 0rpx 24rpx 0rpx 24rpx;
	}

	.addProduct_fd1_3_c2_c1_c1 {
		width: 17rpx;
		height: 40rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
		margin: 0rpx 0rpx 0rpx 16rpx;
	}

	.addProduct_fd1_3_c2_c1_c0 {
		text-align: right;
	}

	.addProduct_fd1_3_c2_c0_c0 {
		color: #333333;
		font-size: 28rpx;
		font-weight: 400;
		line-height: 30rpx;
	}

	.addProduct_fd1_3_c2 {
		border-bottom: 1px solid #eee;
		padding: 28rpx 0rpx 28rpx 0rpx;
	}

	.addProduct_fd1_3_c1_c1_c1 {
		width: 17rpx;
		height: 40rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
		margin: 0rpx 0rpx 0rpx 16rpx;
	}

	.addProduct_fd1_3_c1_c1_c0 {
		text-align: right;
	}

	.addProduct_fd1_3_c1_c0_c0 {
		color: #333333;
		font-size: 28rpx;
		font-weight: 400;
		line-height: 30rpx;
	}

	.addProduct_fd1_3_c1 {
		border-bottom: 1px solid #eee;
		padding: 28rpx 0rpx 28rpx 0rpx;
	}

	.addProduct_fd1_3_c0_c1_c1 {
		width: 17rpx;
		height: 40rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
		margin: 0rpx 0rpx 0rpx 16rpx;
	}

	.addProduct_fd1_3_c0_c1_c0 {
		text-align: right;
	}

	.addProduct_fd1_3_c0_c0_c0 {
		color: #333333;
		font-size: 28rpx;
		font-weight: 400;
		line-height: 30rpx;
	}

	.addProduct_fd1_3_c0 {
		border-bottom: 1px solid #eee;
		padding: 28rpx 0rpx 28rpx 0rpx;
	}

	.addProduct_fd1_3 {
		background: rgba(255, 255, 255, 1);
		margin: 24rpx 0rpx 0rpx 0rpx;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
		background-size: 100% auto !important;
		padding: 0rpx 24rpx 0rpx 24rpx;
	}

	.addProduct_fd1_2_c2_c1_c1 {
		width: 14rpx;
		height: 26rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
		margin: 0rpx 0rpx 0rpx 16rpx;
	}

	.addProduct_fd1_2_c2_c1_c0 {
		text-align: right;
	}

	.addProduct_fd1_2_c2_c0_c0 {
		color: #333333;
		font-size: 28rpx;
		font-weight: 400;
		line-height: 30rpx;
	}

	.addProduct_fd1_2_c2 {
		border-bottom: 1px solid #eee;
		padding: 28rpx 0rpx 28rpx 0rpx;
	}

	.addProduct_fd1_2_c1_c1_c0_1 {
		width: 72rpx;
		height: 32rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
	}

	.addProduct_fd1_2_c1_c1_c0 {
		width: 72rpx;
		height: 32rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
	}

	.addProduct_fd1_2_c1_c0_c0 {
		color: #333333;
		font-size: 28rpx;
		font-weight: 400;
		line-height: 30rpx;
	}

	.addProduct_fd1_2_c1 {
		border-bottom: 1px solid #eee;
		padding: 28rpx 0rpx 28rpx 0rpx;
	}

	.addProduct_fd1_2_c0_c1_c1 {
		width: 14rpx;
		height: 26rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
		margin: 0rpx 0rpx 0rpx 16rpx;
	}

	.addProduct_fd1_2_c0_c1_c0 {
		text-align: right;
	}

	.addProduct_fd1_2_c0_c0_c0 {
		color: #333333;
		font-size: 28rpx;
		font-weight: 400;
		line-height: 30rpx;
	}

	.addProduct_fd1_2_c0 {
		border-bottom: 1px solid #eee;
		padding: 28rpx 0rpx 28rpx 0rpx;
	}

	.addProduct_fd1_2 {
		background: rgba(255, 255, 255, 1);
		margin: 24rpx 0rpx 0rpx 0rpx;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
		background-size: 100% auto !important;
		padding: 0rpx 24rpx 0rpx 24rpx;
	}

	.addProduct_numberfd1_1_c1_c0_c0 {
		width: 100%;
		font-size: 24rpx;
		color: rgba(81, 37, 37, 1);
		line-height: 24rpx;
		font-weight: 400;
	}

	.addProduct_input_fd1_1_c1_c0 {
		width: 100%;
		height: 99rpx;
		font-size: 28rpx;
		font-weight: 400;
		color: #333;
		white-space: pre-wrap;
	}

	.addProduct_fd1_1_c1_c0 {
		background: rgba(255, 255, 255, 1);
		border-radius: 16rpx 16rpx 16rpx 16rpx;
		padding: 24rpx 24rpx 24rpx 24rpx;
		width: 702rpx;
		height: 164rpx;
	}

	.addProduct_fd1_1_c1 {
		margin: 24rpx 0rpx 0rpx 0rpx;
	}

	.addProduct_fd1_1_c0_c0 {
		color: #0E0E0C;
		font-size: 28rpx;
		font-weight: 500;
		line-height: 38rpx;
	}

	.addProduct_fd1_1 {
		margin: 40rpx 0rpx 0rpx 0rpx;
	}

	.addProduct_numberfd1_0_c1_c0_c0 {
		width: 100%;
		font-size: 24rpx;
		color: rgba(81, 37, 37, 1);
		line-height: 24rpx;
		font-weight: 400;
	}

	.addProduct_input_fd1_0_c1_c0 {
		width: 100%;
		height: 99rpx;
		font-size: 28rpx;
		font-weight: 400;
		color: #333;
		white-space: pre-wrap;
	}

	.addProduct_fd1_0_c1_c0 {
		background: rgba(255, 255, 255, 1);
		border-radius: 16rpx 16rpx 16rpx 16rpx;
		padding: 24rpx 24rpx 24rpx 24rpx;
		width: 702rpx;
		height: 164rpx;
	}

	.addProduct_fd1_0_c1 {
		margin: 24rpx 0rpx 0rpx 0rpx;
	}

	.addProduct_fd1_0_c0_c0 {
		color: #0E0E0C;
		font-size: 28rpx;
		font-weight: 500;
		line-height: 38rpx;
	}

	.addProduct_flex_2 {
		background: #fff;
		width: 540rpx;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
	}

	.addProduct_fd2_2_c1 {
		border-top: 1px solid #eee;
		border-left: 1px solid #eee;
		background: #fff;
		line-height: 110rpx;
		border-radius: 0rpx 0rpx 16rpx 0rpx;
		font-size: 32rpx;
		color: rgba(255, 147, 0, 1);
		width: 270rpx;
	}

	.addProduct_fd2_2_c0 {
		border-top: 1px solid #eee;
		background: #fff;
		line-height: 110rpx;
		border-radius: 0rpx 0rpx 0rpx 16rpx;
		font-size: 32rpx;
		color: rgba(153, 153, 153, 1);
		padding: 0rpx 103rpx 0rpx 103rpx;
	}

	.addProduct_fd2_2 {
		margin: 37rpx 0rpx 0rpx 0rpx;
	}

	.addProduct_fd2_1 {
		line-height: 44rpx;
		font-size: 32rpx;
		font-weight: 500;
		color: #333333;
	}

	.addProduct_fd2_0 {
		font-size: 36rpx;
		font-weight: 800;
		line-height: 44rpx;
		color: #333333;
		margin: 40rpx 0rpx 40rpx 0rpx;
	}

	.addProduct_flex_3 {
		background: rgba(248, 248, 248, 1);
		width: 750rpx;
		height: 128rpx;
		overflow: hidden;
		z-index: 10;
		bottom: calc(0rpx + var(--window-bottom));
		background-size: 100% auto !important;
	}

	.addProduct_fd3_1_c1 {
		background: rgba(255, 147, 0, 1);
		border-radius: 44rpx 44rpx 44rpx 44rpx;
		font-size: 30rpx;
		color: rgba(255, 255, 255, 1);
		width: 339rpx;
		height: 88rpx;
		line-height: 88rpx;
	}

	.addProduct_fd3_1_c0 {
		border: 1px solid rgba(237, 64, 64, 1);
		background: rgba(255, 255, 255, 1);
		border-radius: 44rpx 44rpx 44rpx 44rpx;
		font-size: 30rpx;
		color: rgba(237, 64, 64, 1);
		width: 339rpx;
		height: 88rpx;
		line-height: 88rpx;
	}

	.addProduct_fd3_1 {
		margin: 24rpx 24rpx 0rpx 24rpx;
	}

	.addProduct_fd3_0_c0 {
		background: rgba(255, 147, 0, 1);
		border-radius: 44rpx 44rpx 44rpx 44rpx;
		font-size: 32rpx;
		color: #fff;
		height: 88rpx;
		line-height: 88rpx;
	}

	.addProduct_fd3_0 {
		margin: 24rpx 24rpx 0rpx 24rpx;
	}

	.addProduct_picker4_0_c2 {
		color: rgba(51, 51, 51, 1);
	}

	.addProduct_picker4_0 {
		border-bottom: 1px solid #eee;
		background: #fff;
		padding: 0rpx 32rpx 0rpx 32rpx;
		line-height: 88rpx;
		border-radius: 25rpx 25rpx 0rpx 0rpx;
		background-size: 100% auto !important;
	}

	.addProduct_flex_5 {
		background: #fff;
		background-size: 100% auto !important;
		border-radius: 24rpx 24rpx 0rpx 0rpx;
		padding: 40rpx 0rpx 58rpx 0rpx;
	}

	.addProduct_fd5_1_c1_c1 {
		font-size: 24rpx;
		font-weight: 400;
		color: #333333;
		margin: 16rpx 0rpx 0rpx 0rpx;
	}

	.addProduct_fd5_1_c1_c0 {
		width: 88rpx;
		height: 88rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
	}

	.addProduct_fd5_1_c0_c1 {
		font-size: 24rpx;
		font-weight: 400;
		color: #333333;
		margin: 16rpx 0rpx 0rpx 0rpx;
	}

	.addProduct_fd5_1_c0_c0 {
		width: 88rpx;
		height: 88rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
	}

	.addProduct_fd5_1 {
		margin: 48rpx 0rpx 0rpx 0rpx;
		padding: 0rpx 146rpx 0rpx 146rpx;
	}

	.addProduct_fd5_0_c2_c0 {
		width: 28rpx;
		height: 28rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
	}

	.addProduct_fd5_0_c1_c0 {
		color: #333333;
		font-size: 36rpx;
		font-weight: 500;
		line-height: 53rpx;
		margin: 0rpx 20rpx 0rpx 20rpx;
	}

	.addProduct_fd5_0_c0 {
		width: 40rpx;
		height: 40rpx;
	}

	.addProduct_fd5_0 {
		padding: 0rpx 32rpx 0rpx 32rpx;
	}
</style>
