|
|
@@ -287,7 +287,7 @@
|
|
|
<el-col :xl="24" :lg="24" :md="24" :sm="24" :xs="24">
|
|
|
<!-- 单规格表格-->
|
|
|
<el-form-item v-if="formValidate.specType === false">
|
|
|
- <el-alert title="价格设置范围 0.01~999999.99" type="info"> </el-alert>
|
|
|
+ <el-alert :title="'价格设置范围 0.01~999999.99,sLgns价格根据当前汇率实时换算,当前rmb转slgns汇率:' + lgnToCny" type="info"> </el-alert>
|
|
|
<el-table :data="OneattrValue" border class="tabNumWidth" size="small">
|
|
|
<el-table-column label="图片" width="60" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
@@ -345,12 +345,13 @@
|
|
|
<el-input-number
|
|
|
v-else
|
|
|
v-model.trim="scope.row[iii]"
|
|
|
- :disabled="isDisabled || (iii === 'stock' && formValidate.type == 6 ? true : false)"
|
|
|
+ :disabled="isDisabled || (iii === 'stock' && formValidate.type == 6 ? true : false) || iii === 'price' || iii === 'cost' || iii === 'otPrice' || iii === 'vipPrice'"
|
|
|
:min="iii === 'stock' || iii === 'weight' || iii === 'volume' ? 0 : 0.01"
|
|
|
:max="formValidate.isPaidMember && iii === 'vipPrice' ? Number(scope.row.price) - 0.01 : 999999.99"
|
|
|
:step="iii === 'stock' ? 1 : 0.01"
|
|
|
controls-position="right"
|
|
|
step-strictly
|
|
|
+ @change="['priceRmb', 'vipPriceRmb', 'costRmb', 'otPriceRmb'].includes(iii) ? changePrice(scope.row, scope.$index, iii.replace('Rmb', '')) : null"
|
|
|
></el-input-number>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
@@ -411,7 +412,7 @@
|
|
|
class="labeltop"
|
|
|
:class="isDisabled ? 'disLabel' : 'disLabelmoren'"
|
|
|
>
|
|
|
- <el-alert title="价格设置范围 0.01~999999.99" type="info"> </el-alert>
|
|
|
+ <el-alert :title="'价格设置范围 0.01~999999.99 sLgns价格根据当前汇率实时换算,当前rmb转slgns汇率:' + lgnToCny" type="info"> </el-alert>
|
|
|
<el-table
|
|
|
:data="ManyAttrValue"
|
|
|
border
|
|
|
@@ -471,6 +472,20 @@
|
|
|
controls-position="right"
|
|
|
class="priceBox"
|
|
|
clearable
|
|
|
+ :disabled="true"
|
|
|
+ ></el-input-number>
|
|
|
+ </template>
|
|
|
+ <template v-else-if="item.slot === 'priceRmb'">
|
|
|
+ <el-input-number
|
|
|
+ :controls="false"
|
|
|
+ v-model="oneFormBatch[0].priceRmb"
|
|
|
+ :min="0.01"
|
|
|
+ :max="999999.99"
|
|
|
+ :step="0.01"
|
|
|
+ controls-position="right"
|
|
|
+ class="priceBox"
|
|
|
+ clearable
|
|
|
+ @change="changePrice(oneFormBatch[0], 0, 'price')"
|
|
|
></el-input-number>
|
|
|
</template>
|
|
|
<template v-else-if="item.slot === 'vipPrice' && formValidate.isPaidMember">
|
|
|
@@ -483,6 +498,20 @@
|
|
|
controls-position="right"
|
|
|
class="priceBox"
|
|
|
clearable
|
|
|
+ :disabled="true"
|
|
|
+ ></el-input-number>
|
|
|
+ </template>
|
|
|
+ <template v-else-if="item.slot === 'vipPriceRmb' && formValidate.isPaidMember">
|
|
|
+ <el-input-number
|
|
|
+ :controls="false"
|
|
|
+ v-model="oneFormBatch[0].vipPriceRmb"
|
|
|
+ :min="0.01"
|
|
|
+ :max="999999.99"
|
|
|
+ :step="0.01"
|
|
|
+ controls-position="right"
|
|
|
+ class="priceBox"
|
|
|
+ clearable
|
|
|
+ @change="changePrice(oneFormBatch[0], 0, 'vipPrice')"
|
|
|
></el-input-number>
|
|
|
</template>
|
|
|
<template v-else-if="item.slot === 'cost'">
|
|
|
@@ -495,6 +524,20 @@
|
|
|
controls-position="right"
|
|
|
class="priceBox"
|
|
|
clearable
|
|
|
+ :disabled="true"
|
|
|
+ ></el-input-number>
|
|
|
+ </template>
|
|
|
+ <template v-else-if="item.slot === 'costRmb'">
|
|
|
+ <el-input-number
|
|
|
+ :controls="false"
|
|
|
+ v-model="oneFormBatch[0].costRmb"
|
|
|
+ :min="0.01"
|
|
|
+ :max="999999.99"
|
|
|
+ :step="0.01"
|
|
|
+ controls-position="right"
|
|
|
+ class="priceBox"
|
|
|
+ clearable
|
|
|
+ @change="changePrice(oneFormBatch[0], 0, 'cost')"
|
|
|
></el-input-number>
|
|
|
</template>
|
|
|
<template v-else-if="item.slot === 'otPrice'">
|
|
|
@@ -507,6 +550,20 @@
|
|
|
controls-position="right"
|
|
|
class="priceBox"
|
|
|
clearable
|
|
|
+ :disabled="true"
|
|
|
+ ></el-input-number>
|
|
|
+ </template>
|
|
|
+ <template v-else-if="item.slot === 'otPriceRmb'">
|
|
|
+ <el-input-number
|
|
|
+ :controls="false"
|
|
|
+ v-model="oneFormBatch[0].otPriceRmb"
|
|
|
+ :min="0.01"
|
|
|
+ :max="999999.99"
|
|
|
+ :step="0.01"
|
|
|
+ controls-position="right"
|
|
|
+ class="priceBox"
|
|
|
+ clearable
|
|
|
+ @change="changePrice(oneFormBatch[0], 0, 'otPrice')"
|
|
|
></el-input-number>
|
|
|
</template>
|
|
|
<template v-else-if="item.slot === 'stock' && formValidate.type !== OrderSecondTypeEnum.Reservation">
|
|
|
@@ -599,6 +656,17 @@
|
|
|
:min="0.01"
|
|
|
:max="999999.99"
|
|
|
class="priceBox"
|
|
|
+ :disabled="true"
|
|
|
+ ></el-input-number>
|
|
|
+ </template>
|
|
|
+ <template v-else-if="item.slot === 'priceRmb'">
|
|
|
+ <el-input-number
|
|
|
+ :controls="false"
|
|
|
+ v-model="ManyAttrValue[scope.$index].priceRmb"
|
|
|
+ :min="0.01"
|
|
|
+ :max="999999.99"
|
|
|
+ class="priceBox"
|
|
|
+ @change="changePrice(ManyAttrValue[scope.$index], scope.$index, 'price')"
|
|
|
></el-input-number>
|
|
|
</template>
|
|
|
<template v-else-if="item.slot === 'vipPrice' && formValidate.isPaidMember">
|
|
|
@@ -609,6 +677,18 @@
|
|
|
:max="999999.99"
|
|
|
class="priceBox"
|
|
|
clearable
|
|
|
+ :disabled="true"
|
|
|
+ ></el-input-number>
|
|
|
+ </template>
|
|
|
+ <template v-else-if="item.slot === 'vipPriceRmb' && formValidate.isPaidMember">
|
|
|
+ <el-input-number
|
|
|
+ :controls="false"
|
|
|
+ v-model="ManyAttrValue[scope.$index].vipPriceRmb"
|
|
|
+ :min="0.01"
|
|
|
+ :max="999999.99"
|
|
|
+ class="priceBox"
|
|
|
+ clearable
|
|
|
+ @change="changePrice(ManyAttrValue[scope.$index], scope.$index, 'vipPrice')"
|
|
|
></el-input-number>
|
|
|
</template>
|
|
|
<template v-else-if="item.slot === 'cost'">
|
|
|
@@ -618,6 +698,17 @@
|
|
|
:min="0.01"
|
|
|
:max="999999.99"
|
|
|
class="priceBox"
|
|
|
+ :disabled="true"
|
|
|
+ ></el-input-number>
|
|
|
+ </template>
|
|
|
+ <template v-else-if="item.slot === 'costRmb'">
|
|
|
+ <el-input-number
|
|
|
+ :controls="false"
|
|
|
+ v-model="ManyAttrValue[scope.$index].costRmb"
|
|
|
+ :min="0.01"
|
|
|
+ :max="999999.99"
|
|
|
+ class="priceBox"
|
|
|
+ @change="changePrice(ManyAttrValue[scope.$index], scope.$index, 'cost')"
|
|
|
></el-input-number>
|
|
|
</template>
|
|
|
<template v-else-if="item.slot === 'otPrice'">
|
|
|
@@ -627,6 +718,17 @@
|
|
|
:min="0.01"
|
|
|
:max="999999.99"
|
|
|
class="priceBox"
|
|
|
+ :disabled="true"
|
|
|
+ ></el-input-number>
|
|
|
+ </template>
|
|
|
+ <template v-else-if="item.slot === 'otPriceRmb'">
|
|
|
+ <el-input-number
|
|
|
+ :controls="false"
|
|
|
+ v-model="ManyAttrValue[scope.$index].otPriceRmb"
|
|
|
+ :min="0.01"
|
|
|
+ :max="999999.99"
|
|
|
+ class="priceBox"
|
|
|
+ @change="changePrice(ManyAttrValue[scope.$index], scope.$index, 'otPrice')"
|
|
|
></el-input-number>
|
|
|
</template>
|
|
|
<template v-else-if="item.slot === 'stock' && formValidate.type !== OrderSecondTypeEnum.Reservation">
|
|
|
@@ -792,7 +894,7 @@
|
|
|
import addCdkey from '@/views/product/components/addCdkey.vue';
|
|
|
import addCloudDisk from '@/views/product/components/addCloudDisk.vue';
|
|
|
import vuedraggable from 'vuedraggable';
|
|
|
-import { attrCreatApi, templateListApi } from '@/api/product';
|
|
|
+import { attrCreatApi, templateListApi, getSlRateApi } from '@/api/product';
|
|
|
import { arraysEqual } from '@/utils';
|
|
|
import product from '@/mixins/product';
|
|
|
import { defaultObj } from '../creatProduct/default';
|
|
|
@@ -833,8 +935,10 @@ export default {
|
|
|
delete obj.attrValueReservationList;
|
|
|
if (!this.formValidate.isPaidMember) {
|
|
|
delete obj.vipPrice;
|
|
|
+ delete obj.vipPriceRmb;
|
|
|
} else {
|
|
|
obj.vipPrice = Object.assign({}, defaultObj.attrValueList[0]).vipPrice;
|
|
|
+ obj.vipPriceRmb = Object.assign({}, defaultObj.attrValueList[0]).vipPriceRmb;
|
|
|
}
|
|
|
if (this.formValidate.type === 2) {
|
|
|
delete obj.itemNumber;
|
|
|
@@ -860,6 +964,7 @@ export default {
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ lgnToCny:0,
|
|
|
OrderSecondTypeEnum: OrderSecondTypeEnum,
|
|
|
carMytabIndex: 0,
|
|
|
carMytabName: '',
|
|
|
@@ -968,6 +1073,11 @@ export default {
|
|
|
},
|
|
|
},
|
|
|
mounted() {
|
|
|
+ getSlRateApi().then(res => {
|
|
|
+ this.lgnToCny = res.LGNS_TO_CNY
|
|
|
+ // 确保 lgnToCny 字段在提交表单时一同提交。 修改点: 在 creatAttr.vue 组件加载并获取到汇率后,使用 this.$set 将 lgnToCny 写入到 formValidate 对象中。这样在点击保存/提审时,index.vue 组装表单数据会自动包含该字段。
|
|
|
+ this.$set(this.formValidate, 'lgnToCny', res.LGNS_TO_CNY);
|
|
|
+ });
|
|
|
this.getTimeCheckGroup()
|
|
|
//预约商品
|
|
|
if (this.$route.params.id && this.$route.params.id != 0 && this.formValidate.type === 7) {
|
|
|
@@ -1101,7 +1211,27 @@ export default {
|
|
|
this.carMytabIndex = index;
|
|
|
this.carMytabName = name;
|
|
|
this.dialogVisible = true;
|
|
|
+ this.carMytabIndex = index;
|
|
|
+ this.carMytabName = name;
|
|
|
+ this.dialogVisible = true;
|
|
|
}),
|
|
|
+ /**
|
|
|
+ * 自动计算 sL 价格
|
|
|
+ * @param row 行数据
|
|
|
+ * @param index 行索引
|
|
|
+ * @param type 类型 price, vipPrice, cost, otPrice
|
|
|
+ */
|
|
|
+ changePrice(row, index, type) {
|
|
|
+ if (!this.lgnToCny) return;
|
|
|
+ let rmbKey = type + 'Rmb'; // e.g. priceRmb
|
|
|
+ let rmbVal = row[rmbKey];
|
|
|
+ // 计算: 向上取整(val / rate * 100) / 100
|
|
|
+ let slVal = Math.ceil((rmbVal / this.lgnToCny) * 100) / 100;
|
|
|
+ row[type] = slVal;
|
|
|
+ // 如果是批量设置 (Row index 0 and passed oneFormBatch row?)
|
|
|
+ // Actually row is passed by reference, so modifying it is enough.
|
|
|
+ // But if it's single spec or multi spec, the binding ensures update.
|
|
|
+ },
|
|
|
// 设置预约库存弹窗生成时间、库存,只在新增中调用, 设置数量跟时间,用一个updateList函数复用批量和单个逻辑。
|
|
|
updateList(item) {
|
|
|
const oldList = item.attrValueReservationList || [];
|
|
|
@@ -1370,6 +1500,10 @@ export default {
|
|
|
vipPrice: 0.01,
|
|
|
cost: 0.01,
|
|
|
otPrice: 0.01,
|
|
|
+ priceRmb: 0.01,
|
|
|
+ vipPriceRmb: 0.01,
|
|
|
+ costRmb: 0.01,
|
|
|
+ otPriceRmb: 0.01,
|
|
|
barCode: '',
|
|
|
itemNumber: '',
|
|
|
stock: 0,
|
|
|
@@ -1413,7 +1547,15 @@ export default {
|
|
|
cdkeyId: manyItem.cdkeyId || '',
|
|
|
cdkey: manyItem.cdkey || {},
|
|
|
expand: manyItem.expand || '',
|
|
|
- cdkeyLibraryName: manyItem.cdkeyLibraryName || ''
|
|
|
+ attrValueReservationList: manyItem.attrValueReservationList || [],
|
|
|
+ cdkeyId: manyItem.cdkeyId || '',
|
|
|
+ cdkey: manyItem.cdkey || {},
|
|
|
+ expand: manyItem.expand || '',
|
|
|
+ cdkeyLibraryName: manyItem.cdkeyLibraryName || '',
|
|
|
+ priceRmb: manyItem.priceRmb || 0.01,
|
|
|
+ vipPriceRmb: manyItem.vipPriceRmb || 0.01,
|
|
|
+ costRmb: manyItem.costRmb || 0.01,
|
|
|
+ otPriceRmb: manyItem.otPriceRmb || 0.01,
|
|
|
});
|
|
|
} else if (k > 0 && manyItem.attr_arr.length && data[i].add_pic && combination.includes(val)) {
|
|
|
// data[i].detail中的value是规格值 存在与 manyItem.attr_arr 中的某一项
|
|
|
@@ -1817,8 +1959,11 @@ export default {
|
|
|
batchData(val) {
|
|
|
if (this.oneFormBatch[0].image) this.$set(val, 'image', this.oneFormBatch[0].image);
|
|
|
if (this.oneFormBatch[0].price > 0) this.$set(val, 'price', this.oneFormBatch[0].price);
|
|
|
+ if (this.oneFormBatch[0].priceRmb > 0) this.$set(val, 'priceRmb', this.oneFormBatch[0].priceRmb);
|
|
|
if (this.oneFormBatch[0].cost > 0) this.$set(val, 'cost', this.oneFormBatch[0].cost);
|
|
|
+ if (this.oneFormBatch[0].costRmb > 0) this.$set(val, 'costRmb', this.oneFormBatch[0].costRmb);
|
|
|
if (this.oneFormBatch[0].otPrice > 0) this.$set(val, 'otPrice', this.oneFormBatch[0].otPrice);
|
|
|
+ if (this.oneFormBatch[0].otPriceRmb > 0) this.$set(val, 'otPriceRmb', this.oneFormBatch[0].otPriceRmb);
|
|
|
if (this.oneFormBatch[0].barCode) this.$set(val, 'barCode', this.oneFormBatch[0].barCode);
|
|
|
if (this.oneFormBatch[0].stock >= 0) this.$set(val, 'stock', this.oneFormBatch[0].stock);
|
|
|
if (this.oneFormBatch[0].weight >= 0) this.$set(val, 'weight', this.oneFormBatch[0].weight);
|
|
|
@@ -1826,6 +1971,7 @@ export default {
|
|
|
if (this.oneFormBatch[0].brokerage > 0) this.$set(val, 'brokerage', this.oneFormBatch[0].brokerage);
|
|
|
if (this.oneFormBatch[0].brokerageTwo > 0) this.$set(val, 'brokerageTwo', this.oneFormBatch[0].brokerageTwo);
|
|
|
if (this.oneFormBatch[0].vipPrice > 0) this.$set(val, 'vipPrice', this.oneFormBatch[0].vipPrice);
|
|
|
+ if (this.oneFormBatch[0].vipPriceRmb > 0) this.$set(val, 'vipPriceRmb', this.oneFormBatch[0].vipPriceRmb);
|
|
|
if (this.oneFormBatch[0].itemNumber) this.$set(val, 'itemNumber', this.oneFormBatch[0].itemNumber);
|
|
|
},
|
|
|
// 添加按钮
|