|
|
@@ -13,7 +13,7 @@
|
|
|
<Row type="flex" class="mt30 acea-row row-middle row-center">
|
|
|
<Col span="20">
|
|
|
<Steps :current="current">
|
|
|
- <Step title="选择租车商品"></Step>
|
|
|
+ <!-- <Step title="选择租车商品"></Step> -->
|
|
|
<Step title="填写基础信息"></Step>
|
|
|
<Step title="修改商品详情"></Step>
|
|
|
</Steps>
|
|
|
@@ -22,29 +22,7 @@
|
|
|
<Form class="form mt30" ref="formValidate" :model="formValidate" :rules="ruleValidate"
|
|
|
@on-validate="validate" :label-width="labelWidth" :label-position="labelPosition"
|
|
|
@submit.native.prevent>
|
|
|
- <FormItem label="选择商品:" prop="image_input" v-if="current === 0">
|
|
|
- <div class="picBox" @click="changeGoods">
|
|
|
- <div class="pictrue" v-if="formValidate.image">
|
|
|
- <img v-lazy="formValidate.image" />
|
|
|
- </div>
|
|
|
- <div class="upLoad acea-row row-center-wrapper" v-else>
|
|
|
- <Icon type="ios-camera-outline" size="26" class="iconfonts" />
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </FormItem>
|
|
|
- <Col v-show="current === 1" type="flex">
|
|
|
- <!-- <Col span="24">
|
|
|
- <FormItem label="商品主图:" prop="image">
|
|
|
- <div class="picBox" @click="modalPicTap('dan', 'danFrom')">
|
|
|
- <div class="pictrue" v-if="formValidate.image">
|
|
|
- <img v-lazy="formValidate.image" />
|
|
|
- </div>
|
|
|
- <div class="upLoad acea-row row-center-wrapper" v-else>
|
|
|
- <Icon type="ios-camera-outline" size="26" class="iconfont" />
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </FormItem>
|
|
|
- </Col> -->
|
|
|
+ <Col v-show="current === 0" type="flex">
|
|
|
<Col span="24">
|
|
|
<FormItem label="商品轮播图:" prop="images">
|
|
|
<div class="acea-row">
|
|
|
@@ -79,19 +57,21 @@
|
|
|
</Col>
|
|
|
</Col>
|
|
|
<Col span="24">
|
|
|
- <FormItem label="单位:" prop="unit_name" label-for="unit_name">
|
|
|
- <Input placeholder="请输入单位" element-id="unit_name" v-model="formValidate.unit_name"
|
|
|
- class="perW20" />
|
|
|
- </FormItem>
|
|
|
</Col>
|
|
|
<Col span="24">
|
|
|
- <FormItem label="排序:">
|
|
|
+ <FormItem label="排序:" prop="sort">
|
|
|
<InputNumber placeholder="请输入排序" element-id="sort" :precision="0" :max="10000" :min="0"
|
|
|
v-model="formValidate.sort" class="perW10" />
|
|
|
</FormItem>
|
|
|
</Col>
|
|
|
<Col span="24">
|
|
|
- <FormItem label="以租代购:" props="car_lease" label-for="car_lease">
|
|
|
+ <FormItem label="租车价:" prop="price">
|
|
|
+ <InputNumber placeholder="请输入每月租车价格" element-id="price" :precision="0" :max="10000" :min="0"
|
|
|
+ v-model="formValidate.price" class="perW10" />
|
|
|
+ </FormItem>
|
|
|
+ </Col>
|
|
|
+ <Col span="24">
|
|
|
+ <FormItem label="以租代购:" prop="car_lease" label-for="car_lease">
|
|
|
<RadioGroup element-id="car_lease" v-model="formValidate.car_lease">
|
|
|
<Radio :label="1" class="radio">是</Radio>
|
|
|
<Radio :label="0">否</Radio>
|
|
|
@@ -99,37 +79,13 @@
|
|
|
</FormItem>
|
|
|
</Col>
|
|
|
<Col span="24">
|
|
|
- <FormItem v-if="formValidate.car_lease==1" label="还款月份:" props="several_months">
|
|
|
- <InputNumber placeholder="请输入还款月份" element-id="several_months" :precision="0" :max="100" :min="0"
|
|
|
- v-model="formValidate.several_months" class="perW10" />
|
|
|
- </FormItem>
|
|
|
- </Col>
|
|
|
- <Col span="24">
|
|
|
- <FormItem label="规格选择:">
|
|
|
- <Table :data="specsData" :columns="columns" border @on-selection-change="changeCheckbox">
|
|
|
- <template slot-scope="{ row, index }" slot="price">
|
|
|
- <InputNumber v-model="row.price" :min="0.01" :precision="2" class="priceBox" @on-change="
|
|
|
- (e) => {
|
|
|
- changePrice(e, index);
|
|
|
- }
|
|
|
- " :active-change="false"></InputNumber>
|
|
|
- </template>
|
|
|
- <template slot-scope="{ row, index }" slot="pic">
|
|
|
- <div class="acea-row row-middle row-center-wrapper"
|
|
|
- @click="modalPicTap('dan', 'danTable', index)">
|
|
|
- <div class="pictrue pictrueTab" v-if="row.pic">
|
|
|
- <img v-lazy="row.pic" />
|
|
|
- </div>
|
|
|
- <div class="upLoad pictrueTab acea-row row-center-wrapper" v-else>
|
|
|
- <Icon type="ios-camera-outline" size="21" />
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- </Table>
|
|
|
+ <FormItem v-if="formValidate.car_lease==1" label="还款月份:" prop="several_months">
|
|
|
+ <InputNumber placeholder="请输入还款月份" element-id="several_months" :precision="0" :max="100"
|
|
|
+ :min="0" v-model="formValidate.several_months" class="perW10" />
|
|
|
</FormItem>
|
|
|
</Col>
|
|
|
</Col>
|
|
|
- <Row v-show="current === 2">
|
|
|
+ <Row v-show="current === 1">
|
|
|
<Col span="24">
|
|
|
<FormItem label="内容:">
|
|
|
<WangEditor style="width: 90%" :content="formValidate.description"
|
|
|
@@ -140,10 +96,10 @@
|
|
|
<Col span="24">
|
|
|
<FormItem>
|
|
|
<Button class="submission mr15" @click="step" v-show="current !== 0"
|
|
|
- :disabled="$route.params.id && current === 1">上一步
|
|
|
+ :disabled="$route.params.id && current === 0">上一步
|
|
|
</Button>
|
|
|
- <Button :disabled="submitOpen && current === 2" type="primary" class="submission"
|
|
|
- @click="next('formValidate')" v-text="current === 2 ? '提交' : '下一步'"></Button>
|
|
|
+ <Button :disabled="submitOpen && current === 1" type="primary" class="submission"
|
|
|
+ @click="next('formValidate')" v-text="current === 1 ? '提交' : '下一步'"></Button>
|
|
|
</FormItem>
|
|
|
</Col>
|
|
|
</Form>
|
|
|
@@ -151,11 +107,6 @@
|
|
|
</Col>
|
|
|
</Row>
|
|
|
</Card>
|
|
|
- <!-- 选择商品-->
|
|
|
- <Modal v-model="modals" title="商品列表" class="paymentFooter" footerHide scrollable width="900"
|
|
|
- @on-cancel="cancel">
|
|
|
- <goods-list ref="goodslist" @getProductId="getProductId"></goods-list>
|
|
|
- </Modal>
|
|
|
<!-- 上传图片-->
|
|
|
<Modal v-model="modalPic" width="950px" scrollable footer-hide closable title="上传商品图" :mask-closable="false"
|
|
|
:z-index="888">
|
|
|
@@ -169,19 +120,15 @@
|
|
|
import {
|
|
|
mapState
|
|
|
} from 'vuex';
|
|
|
- import goodsList from '@/components/goodsList/index';
|
|
|
import WangEditor from '@/components/wangEditor/index.vue';
|
|
|
import uploadPictures from '@/components/uploadPictures';
|
|
|
- import {
|
|
|
- productAttrsApi
|
|
|
- } from '@/api/marketing';
|
|
|
import {
|
|
|
rentAdd,
|
|
|
+ rentDetail
|
|
|
} from '@/api/rent';
|
|
|
export default {
|
|
|
name: 'storeSeckillCreate',
|
|
|
components: {
|
|
|
- goodsList,
|
|
|
uploadPictures,
|
|
|
WangEditor,
|
|
|
},
|
|
|
@@ -213,7 +160,6 @@
|
|
|
sm: 8,
|
|
|
xs: 8,
|
|
|
},
|
|
|
- modals: false,
|
|
|
modal_loading: false,
|
|
|
images: [],
|
|
|
formValidate: {
|
|
|
@@ -228,15 +174,10 @@
|
|
|
status: 0,
|
|
|
description: '',
|
|
|
id: 0,
|
|
|
- product_id: 0,
|
|
|
- several_months:12,//还款月份
|
|
|
- car_lease:0,//默认关闭以租代购
|
|
|
- attrs: [],
|
|
|
- items: [],
|
|
|
+ several_months: 12, //还款月份
|
|
|
+ car_lease: 0, //默认关闭以租代购
|
|
|
},
|
|
|
description: '',
|
|
|
- columns: [],
|
|
|
- specsData: [],
|
|
|
picTit: '',
|
|
|
tableIndex: 0,
|
|
|
ruleValidate: {
|
|
|
@@ -268,17 +209,18 @@
|
|
|
message: '请输入简介',
|
|
|
trigger: 'blur'
|
|
|
}],
|
|
|
- unit_name: [{
|
|
|
- required: true,
|
|
|
- message: '请输入单位',
|
|
|
- trigger: 'blur'
|
|
|
- }],
|
|
|
price: [{
|
|
|
required: true,
|
|
|
type: 'number',
|
|
|
message: '请输入租车价',
|
|
|
trigger: 'blur',
|
|
|
}, ],
|
|
|
+ several_months: [{
|
|
|
+ required: true,
|
|
|
+ type: 'number',
|
|
|
+ message: '请输入月份',
|
|
|
+ trigger: 'blur',
|
|
|
+ }, ]
|
|
|
},
|
|
|
copy: 0,
|
|
|
};
|
|
|
@@ -293,9 +235,11 @@
|
|
|
},
|
|
|
},
|
|
|
mounted() {
|
|
|
+
|
|
|
+ console.log(this.$route.params, 'pr');
|
|
|
if (this.$route.params.id) {
|
|
|
this.copy = this.$route.params.copy;
|
|
|
- this.current = 1;
|
|
|
+ this.current = 0;
|
|
|
this.getInfo();
|
|
|
}
|
|
|
},
|
|
|
@@ -304,150 +248,23 @@
|
|
|
getEditorContent(data) {
|
|
|
this.description = data;
|
|
|
},
|
|
|
- // 租车商品规格;
|
|
|
- productAttrs(rows) {
|
|
|
- let that = this;
|
|
|
- productAttrsApi(rows.id, 7)
|
|
|
- .then((res) => {
|
|
|
- let data = res.data.info;
|
|
|
- let selection = {
|
|
|
- type: 'selection',
|
|
|
- width: 60,
|
|
|
- align: 'center',
|
|
|
- };
|
|
|
- that.specsData = data.attrs;
|
|
|
- that.specsData.forEach(function(item, index) {
|
|
|
- that.$set(that.specsData[index], 'id', index);
|
|
|
- });
|
|
|
- that.formValidate.items = data.items;
|
|
|
- that.columns = data.header;
|
|
|
- that.columns.unshift(selection);
|
|
|
- that.inputChange(data);
|
|
|
- })
|
|
|
- .catch((res) => {
|
|
|
- that.$Message.error(res.msg);
|
|
|
- });
|
|
|
- },
|
|
|
- inputChange(data) {
|
|
|
- let that = this;
|
|
|
- let $index = [];
|
|
|
- data.header.forEach(function(item, index) {
|
|
|
- if (item.type === 1) {
|
|
|
- $index.push({
|
|
|
- index: index,
|
|
|
- key: item.key,
|
|
|
- title: item.title
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
- $index.forEach(function(item, index) {
|
|
|
- let title = item.title;
|
|
|
- let key = item.key;
|
|
|
- let row = {
|
|
|
- title: title,
|
|
|
- key: key,
|
|
|
- align: 'center',
|
|
|
- minWidth: 100,
|
|
|
- render: (h, params) => {
|
|
|
- return h('div', [
|
|
|
- h('InputNumber', {
|
|
|
- props: {
|
|
|
- min: 1,
|
|
|
- precision: 0,
|
|
|
- value: params.row.quota,
|
|
|
- },
|
|
|
- on: {
|
|
|
- 'on-change': (e) => {
|
|
|
- params.row.quota = e;
|
|
|
- that.specsData[params.index] = params.row;
|
|
|
- if (!!that.formValidate.attrs && that
|
|
|
- .formValidate.attrs.length) {
|
|
|
- that.formValidate.attrs.forEach((v,
|
|
|
- index) => {
|
|
|
- if (v.id === params.row.id) {
|
|
|
- that.formValidate.attrs
|
|
|
- .splice(index, 1,
|
|
|
- params.row);
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- },
|
|
|
- },
|
|
|
- }),
|
|
|
- ]);
|
|
|
- },
|
|
|
- };
|
|
|
- that.columns.splice(item.index, 1, row);
|
|
|
- });
|
|
|
- },
|
|
|
- // 多选
|
|
|
- changeCheckbox(selection) {
|
|
|
- this.formValidate.attrs = selection;
|
|
|
- },
|
|
|
// 表单验证
|
|
|
validate(prop, status, error) {
|
|
|
if (status === false) {
|
|
|
this.$Message.error(error);
|
|
|
}
|
|
|
},
|
|
|
- // 商品id
|
|
|
- getProductId(row) {
|
|
|
- this.modal_loading = false;
|
|
|
- this.modals = false;
|
|
|
- setTimeout(() => {
|
|
|
- this.formValidate = {
|
|
|
- images: row.slider_image,
|
|
|
- info: row.store_info,
|
|
|
- title: row.store_name,
|
|
|
- image: row.image,
|
|
|
- unit_name: row.unit_name,
|
|
|
- price: 0, // 不取商品中的原价
|
|
|
- sales: row.sales,
|
|
|
- sort: row.sort,
|
|
|
- status: 0,
|
|
|
- description: row.description,
|
|
|
- id: 0,
|
|
|
- product_id: row.id,
|
|
|
- custom_form: row.custom_form, //自定义表单数据
|
|
|
- car_lease:0,//默认关闭以租代购
|
|
|
- several_months:12,//需要几个月
|
|
|
- };
|
|
|
- this.productAttrs(row);
|
|
|
- this.$refs.goodslist.productRow = null;
|
|
|
- }, 500);
|
|
|
- },
|
|
|
- cancel() {
|
|
|
- this.modals = false;
|
|
|
- },
|
|
|
// 详情
|
|
|
getInfo() {
|
|
|
this.spinShow = true;
|
|
|
+ console.log(this.$route.params.id, 'id');
|
|
|
rentDetail(this.$route.params.id)
|
|
|
.then(async (res) => {
|
|
|
let that = this;
|
|
|
let info = res.data.info;
|
|
|
- let selection = {
|
|
|
- type: 'selection',
|
|
|
- width: 60,
|
|
|
- align: 'center',
|
|
|
- };
|
|
|
this.formValidate = info;
|
|
|
- this.$set(this.formValidate, 'items', info.attrs.items);
|
|
|
- this.columns = info.attrs.header;
|
|
|
- this.columns.unshift(selection);
|
|
|
- that.specsData = info.attrs.value;
|
|
|
- that.specsData.forEach(function(item, index) {
|
|
|
- that.$set(that.specsData[index], 'id', index);
|
|
|
- });
|
|
|
- let data = info.attrs;
|
|
|
- let attr = [];
|
|
|
- for (let index in info.attrs.value) {
|
|
|
- if (info.attrs.value[index]._checked) {
|
|
|
- attr.push(info.attrs.value[index]);
|
|
|
- }
|
|
|
- }
|
|
|
- that.formValidate.attrs = attr;
|
|
|
- this.inputChange(data);
|
|
|
+ this.formValidate.price = +info.price;
|
|
|
+ this.$set(this.formValidate);
|
|
|
this.spinShow = false;
|
|
|
})
|
|
|
.catch((res) => {
|
|
|
@@ -455,19 +272,19 @@
|
|
|
this.$Message.error(res.msg);
|
|
|
});
|
|
|
},
|
|
|
- changePrice(e, index) {
|
|
|
- this.$set(this.specsData[index], 'price', e);
|
|
|
- },
|
|
|
// 下一步
|
|
|
next(name) {
|
|
|
let that = this;
|
|
|
- if (this.current === 2) {
|
|
|
+ if (this.current === 1) {
|
|
|
this.formValidate.description = this.description;
|
|
|
this.$refs[name].validate((valid) => {
|
|
|
if (valid) {
|
|
|
- if (this.copy == 1) this.formValidate.copy = 1;
|
|
|
+ if (this.copy == 1) {
|
|
|
+ this.formValidate.copy = 1;
|
|
|
+ }
|
|
|
this.formValidate.id = Number(this.$route.params.id) || 0;
|
|
|
this.submitOpen = true;
|
|
|
+ console.log(this.formValidate,'up');
|
|
|
rentAdd(this.formValidate)
|
|
|
.then(async (res) => {
|
|
|
this.submitOpen = false;
|
|
|
@@ -486,21 +303,8 @@
|
|
|
return false;
|
|
|
}
|
|
|
});
|
|
|
- } else if (this.current === 1) {
|
|
|
- this.$refs[name].validate((valid) => {
|
|
|
- if (valid) {
|
|
|
- if (!that.formValidate.attrs) {
|
|
|
- return that.$Message.error('请选择属性规格');
|
|
|
- }
|
|
|
- this.current += 1;
|
|
|
- }
|
|
|
- });
|
|
|
- } else {
|
|
|
- if (this.formValidate.images) {
|
|
|
- this.current += 1;
|
|
|
- } else {
|
|
|
- this.$Message.warning('请选择商品');
|
|
|
- }
|
|
|
+ } else if (this.current === 0) {
|
|
|
+ this.current += 1;
|
|
|
}
|
|
|
},
|
|
|
// 上一步
|
|
|
@@ -528,10 +332,6 @@
|
|
|
// this.specsData[this.tableIndex].pic = pc.att_dir;
|
|
|
// break;
|
|
|
default:
|
|
|
- if (!!this.formValidate.attrs && this.formValidate.attrs.length) {
|
|
|
- this.$set(this.specsData[this.tableIndex], '_checked', true);
|
|
|
- }
|
|
|
- this.specsData[this.tableIndex].pic = pc.att_dir;
|
|
|
}
|
|
|
this.modalPic = false;
|
|
|
},
|
|
|
@@ -548,13 +348,6 @@
|
|
|
this.images.splice(i, 1);
|
|
|
this.formValidate.images.splice(i, 1);
|
|
|
},
|
|
|
- // 选择商品
|
|
|
- changeGoods() {
|
|
|
- this.modals = true;
|
|
|
- this.$refs.goodslist.formValidate.is_presale = 0;
|
|
|
- this.$refs.goodslist.getList();
|
|
|
- this.$refs.goodslist.goodsCategory();
|
|
|
- }, // 移动
|
|
|
handleDragStart(e, item) {
|
|
|
this.dragging = item;
|
|
|
},
|