|  | @@ -227,26 +227,18 @@
 | 
	
		
			
				|  |  |                <el-button type="text" size="mini" style="padding:4px 10px;float:left" @click="commodityChoice(row)"
 | 
	
		
			
				|  |  |                  :disabled="detailData.seeDisabled || !row.$cellEdit || browse">选择</el-button>
 | 
	
		
			
				|  |  |                <span>{{ row.code }}</span>
 | 
	
		
			
				|  |  | -            </template>
 | 
	
		
			
				|  |  | +            </template>        
 | 
	
		
			
				|  |  |              <template slot="storageName" slot-scope="{ row }">
 | 
	
		
			
				|  |  |                <el-select v-if="row.$cellEdit" v-model="row.storageName" @focus="getPurchasePrice(row)" allow-create
 | 
	
		
			
				|  |  | -                filterable v-input-limit="2" default-first-option @change="handleStorageNameChange(row)">
 | 
	
		
			
				|  |  | -                <el-option v-for="(item, index) in storageName" :key="index" :label="item.storageName"
 | 
	
		
			
				|  |  | -                  :value="item.storageId"></el-option>
 | 
	
		
			
				|  |  | +                filterable v-input-limit="2" default-first-option @change="handleStorageNameChange(row)" >
 | 
	
		
			
				|  |  | +                <el-option v-for="(item, index) in row.storageQuantity" :key="index"  :label="item.storageName"
 | 
	
		
			
				|  |  | +                  :value="item.storageId" ></el-option>
 | 
	
		
			
				|  |  |                </el-select>
 | 
	
		
			
				|  |  |                <span v-else>{{ row.storageName }}</span>
 | 
	
		
			
				|  |  |              </template>
 | 
	
		
			
				|  |  | -            <template slot="surplusRouteQuantity" slot-scope="{ row }">
 | 
	
		
			
				|  |  | -              <template v-if="row.$cellEdit">
 | 
	
		
			
				|  |  | -                <span v-for="(item, index) in surplusRouteQuantityOption" :key="index">{{ item.surplusRouteQuantity !==
 | 
	
		
			
				|  |  | -                  null && item.surplusRouteQuantity !== undefined ? item.surplusRouteQuantity : '0' }}</span>
 | 
	
		
			
				|  |  | -              </template>
 | 
	
		
			
				|  |  | -              <span v-else>{{ row.surplusRouteQuantity !== null && row.surplusRouteQuantity !== undefined ?
 | 
	
		
			
				|  |  | -                row.surplusRouteQuantity : '0:00' }}</span>
 | 
	
		
			
				|  |  | +            <template slot="storageQuantity" slot-scope="{ row }">
 | 
	
		
			
				|  |  | +              <span v-for="(item, index) in row.storageQuantity"  :key="index" >{{ item.surplusRouteQuantity?item.surplusRouteQuantity:'0'}}</span>
 | 
	
		
			
				|  |  |              </template>
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |              <template slot="purchaseAmount" slot-scope="{ row }">
 | 
	
		
			
				|  |  |                <el-input v-if="row.$cellEdit" v-model="row.purchaseAmount" @focus="getPurchasePrice(row)" allow-create
 | 
	
		
			
				|  |  |                  filterable v-input-limit="2" default-first-option>
 | 
	
	
		
			
				|  | @@ -1538,9 +1530,11 @@ export default {
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      handleStorageNameChange(row) {
 | 
	
		
			
				|  |  | +      console.log(row);
 | 
	
		
			
				|  |  |        // console.log(row.storageQuantity);
 | 
	
		
			
				|  |  | -      this.surplusRouteQuantityOption = row.storageQuantity
 | 
	
		
			
				|  |  | -      console.log(this.surplusRouteQuantityOption);
 | 
	
		
			
				|  |  | +      row.storageQuantity.surplusRouteQuantity= row.storageQuantity.surplusRouteQuantity
 | 
	
		
			
				|  |  | +      // this.surplusRouteQuantityOption = row.storageQuantity
 | 
	
		
			
				|  |  | +      this.storageId = row.storageName
 | 
	
		
			
				|  |  |        // this.surplusRouteQuantityOption = Object.values(row.surplusRouteQuantity);
 | 
	
		
			
				|  |  |        // console.log('2222',row.surplusRouteQuantity);
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -2384,6 +2378,7 @@ export default {
 | 
	
		
			
				|  |  |        this.dialogVisible = false
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      tableDataHandle() {
 | 
	
		
			
				|  |  | +      console.log(this.tableData);
 | 
	
		
			
				|  |  |        this.saveLoading = true;
 | 
	
		
			
				|  |  |        for (let item = 0; item < this.tableData.length; item++) {
 | 
	
		
			
				|  |  |          getMarketPrice({ code: this.tableData[item].code, isFreight: this.form.isFreight, isLabel: this.form.isLabel }).then(res => {
 | 
	
	
		
			
				|  | @@ -2402,7 +2397,11 @@ export default {
 | 
	
		
			
				|  |  |            warehouseId: selectedValue
 | 
	
		
			
				|  |  |          }).then(res => {
 | 
	
		
			
				|  |  |            console.log('1', res.data.data);
 | 
	
		
			
				|  |  | -          this.storageName = res.data.data
 | 
	
		
			
				|  |  | +          this.tableData[item].storageName = res.data.data
 | 
	
		
			
				|  |  | +          // this.storageName.push(...res.data.data)
 | 
	
		
			
				|  |  | +          // console.log(this.storageName);
 | 
	
		
			
				|  |  | +          // console.log(this.tableData[item].storageName);
 | 
	
		
			
				|  |  | +          
 | 
	
		
			
				|  |  |            this.tableData[item].priceCategory = this.tableData[item].goodsTypeName;
 | 
	
		
			
				|  |  |            this.tableData[item].storageQuantity = res.data.data;
 | 
	
		
			
				|  |  |            delete this.tableData[item].goodsTypeName;
 | 
	
	
		
			
				|  | @@ -2878,18 +2877,18 @@ export default {
 | 
	
		
			
				|  |  |          if (valid) {
 | 
	
		
			
				|  |  |            const length = this.goodsActives === 'gift' ? this.contactsData.length : this.goodsShowData.length
 | 
	
		
			
				|  |  |            const length1 = this.goodsActives === 'goods' ? this.giftData : this.goodsShowData
 | 
	
		
			
				|  |  | -          for (let i = 0; i < length; i++) {
 | 
	
		
			
				|  |  | -            const data = this.goodsActives === 'gift' ? this.contactsData : this.goodsShowData;
 | 
	
		
			
				|  |  | -            if (Number(data[i].orderQuantity) > Number(data[i].storageQuantity)) {
 | 
	
		
			
				|  |  | -              return this.$message.error('商品信息第' + (Number(i) + 1) + '行订货数量大于库存数量')
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | -            if (Number(data[i].purchaseAmount) === 0) {
 | 
	
		
			
				|  |  | -              return this.$message.error('商品信息第' + (parseInt(i) + 1) + '行采购价格不能为0')
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | -            if (!Number(data[i].purchaseAmount)) {
 | 
	
		
			
				|  |  | -              return this.$message.error('商品信息第' + (parseInt(i) + 1) + '行采购价格不能为空')
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | -          }
 | 
	
		
			
				|  |  | +          // for (let i = 0; i < length; i++) {
 | 
	
		
			
				|  |  | +          //   const data = this.goodsActives === 'gift' ? this.contactsData : this.goodsShowData;
 | 
	
		
			
				|  |  | +          //   if (Number(data[i].orderQuantity) > Number(data[i].storageQuantity)) {
 | 
	
		
			
				|  |  | +          //     return this.$message.error('商品信息第' + (Number(i) + 1) + '行订货数量大于库存数量')
 | 
	
		
			
				|  |  | +          //   }
 | 
	
		
			
				|  |  | +          //   if (Number(data[i].purchaseAmount) === 0) {
 | 
	
		
			
				|  |  | +          //     return this.$message.error('商品信息第' + (parseInt(i) + 1) + '行采购价格不能为0')
 | 
	
		
			
				|  |  | +          //   }
 | 
	
		
			
				|  |  | +          //   if (!Number(data[i].purchaseAmount)) {
 | 
	
		
			
				|  |  | +          //     return this.$message.error('商品信息第' + (parseInt(i) + 1) + '行采购价格不能为空')
 | 
	
		
			
				|  |  | +          //   }
 | 
	
		
			
				|  |  | +          // }
 | 
	
		
			
				|  |  |            let integral = 0;//积分
 | 
	
		
			
				|  |  |            if (length1) {
 | 
	
		
			
				|  |  |              length1.forEach(item => {
 | 
	
	
		
			
				|  | @@ -2965,14 +2964,16 @@ export default {
 | 
	
		
			
				|  |  |            // 如果有id解锁,没有跳过
 | 
	
		
			
				|  |  |            // this.form.id && this.unLock({moduleName: 'xs',tableName: 'business_order', billId: this.form.id})
 | 
	
		
			
				|  |  |            this.saveLoading = true
 | 
	
		
			
				|  |  | -          // this.surplusRouteQuantityOption.forEach((itm)=>{
 | 
	
		
			
				|  |  | -          //     console.log(itm.storageId);
 | 
	
		
			
				|  |  | +          // this.storageId.forEach((itm)=>{
 | 
	
		
			
				|  |  | +          //   const storageIds = itm
 | 
	
		
			
				|  |  |            //   })
 | 
	
		
			
				|  |  |            console.log(this.form.contactsForm);
 | 
	
		
			
				|  |  | -          this.form.orderItemsList.forEach((item) => {
 | 
	
		
			
				|  |  | -            item.storageQuantity = item.storageQuantity.surplusRouteQuantity;
 | 
	
		
			
				|  |  | -            item.storageId = this.contactsForm.storageId
 | 
	
		
			
				|  |  | +          this.form.orderItemsList.forEach((item, index) => {
 | 
	
		
			
				|  |  | +            item.storageId = this.storageId;
 | 
	
		
			
				|  |  | +            item.storageQuantity = this.surplusRouteQuantityOption[index].surplusRouteQuantity;
 | 
	
		
			
				|  |  |            });
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +          console.log(this.storageId);
 | 
	
		
			
				|  |  |            await this.computedCost()
 | 
	
		
			
				|  |  |            typeSave(this.form).then(res => {
 | 
	
		
			
				|  |  |              // this.$set(this.detailData, 'seeDisabled', true);
 |