|
@@ -16,30 +16,30 @@
|
|
|
<Card :bordered="false" dis-hover class="ivu-mt">
|
|
|
<Form :model="formData" :label-width="150">
|
|
|
<FormItem label="选择对应服务项目:" required>
|
|
|
- <div class="picBox" @click="changeGoods()">
|
|
|
+ <div class="picBox" @click="changeGoods()">
|
|
|
<Button type="primary" v-if="!formData.store_name">选择商品</Button>
|
|
|
- <div class="" v-if="formData.store_name">
|
|
|
+ <div class="" v-if="formData.store_name">
|
|
|
{{formData.store_name}}
|
|
|
- </div>
|
|
|
+ </div>
|
|
|
<Button type="primary" v-if="formData.store_name">
|
|
|
切换商品
|
|
|
</Button>
|
|
|
- </div>
|
|
|
+ </div>
|
|
|
</FormItem>
|
|
|
<FormItem label="价格" v-if="formData.price">
|
|
|
- <Input v-model="formData.price" v-width="320" disabled ></Input>
|
|
|
+ <Input v-model="formData.price" v-width="320" disabled></Input>
|
|
|
</FormItem>
|
|
|
<FormItem label="前端显示:">
|
|
|
- <RadioGroup v-model="formData.is_display" >
|
|
|
- <Radio :label="1">
|
|
|
- <Icon type="social-apple"></Icon>
|
|
|
- <span>显示</span>
|
|
|
- </Radio>
|
|
|
- <Radio :label="0">
|
|
|
- <Icon type="social-android"></Icon>
|
|
|
- <span>隐藏</span>
|
|
|
- </Radio>
|
|
|
- </RadioGroup>
|
|
|
+ <RadioGroup v-model="formData.is_display">
|
|
|
+ <Radio :label="1">
|
|
|
+ <Icon type="social-apple"></Icon>
|
|
|
+ <span>显示</span>
|
|
|
+ </Radio>
|
|
|
+ <Radio :label="0">
|
|
|
+ <Icon type="social-android"></Icon>
|
|
|
+ <span>隐藏</span>
|
|
|
+ </Radio>
|
|
|
+ </RadioGroup>
|
|
|
</FormItem>
|
|
|
<!-- <FormItem label="库存" v-if="formData.repertory">
|
|
|
<Input v-model="formData.repertory" v-width="320" disabled></Input>
|
|
@@ -58,14 +58,16 @@
|
|
|
</FormItem> -->
|
|
|
</Form>
|
|
|
<div style="width: 500px; display: flex;justify-content: center;">
|
|
|
- <Button type="primary" class="submission" @click="save" :disabled="disabled" v-if="!formData.id">立即创建</Button>
|
|
|
- <Button type="primary" class="submission" @click="save" :disabled="disabled" v-else>立即修改</Button>
|
|
|
+ <Button type="primary" class="submission" @click="save" :disabled="disabled"
|
|
|
+ v-if="!formData.id">立即创建</Button>
|
|
|
+ <Button type="primary" class="submission" @click="save" :disabled="disabled" v-else>立即修改</Button>
|
|
|
</div>
|
|
|
</Card>
|
|
|
<!-- 选择商品-->
|
|
|
<Modal v-model="modals" title="商品列表" footerHide class="paymentFooter" scrollable width="900"
|
|
|
- @on-cancel="cancel">
|
|
|
- <goods-list ref="goodslist" :goodsType="1" v-if="modals" @getProductId="getProductId" :serviceProject="1"></goods-list>
|
|
|
+ @on-cancel="cancel">
|
|
|
+ <goods-list ref="goodslist" :goodsType="1" v-if="modals" @getProductId="getProductId"
|
|
|
+ :serviceProject="1"></goods-list>
|
|
|
</Modal>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -74,27 +76,16 @@
|
|
|
import {
|
|
|
mapState
|
|
|
} from "vuex";
|
|
|
- import storeList from "@/components/storeList";
|
|
|
import goodsList from "@/components/goodsList/index";
|
|
|
import {
|
|
|
- couponCategoryApi,
|
|
|
- couponSaveApi,
|
|
|
- couponDetailApi,
|
|
|
- VipEditApi,
|
|
|
- serveAddApi,
|
|
|
serveReadApi,
|
|
|
createServeProduct
|
|
|
} from "@/api/marketing";
|
|
|
- import {
|
|
|
- brandList
|
|
|
- } from "@/api/product";
|
|
|
- // import { formatDate } from '@/utils/validate';
|
|
|
import Setting from "@/setting";
|
|
|
export default {
|
|
|
name: "storeCouponCreate",
|
|
|
components: {
|
|
|
goodsList,
|
|
|
- storeList
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
@@ -125,9 +116,6 @@
|
|
|
currentTab: '1',
|
|
|
};
|
|
|
},
|
|
|
- computed: {
|
|
|
- ...mapState("admin/layout", ["isMobile", "menuCollapse"]),
|
|
|
- },
|
|
|
created() {
|
|
|
if (this.$route.query.id) {
|
|
|
let query = this.$route.query
|
|
@@ -139,48 +127,40 @@
|
|
|
this.formData.craft_price = query.craft_price;
|
|
|
this.formData.sales_commissions = query.sales_commissions
|
|
|
this.formData.superior_commission = query.superior_commission
|
|
|
- this.formData.is_display = query.is_display*1
|
|
|
+ this.formData.is_display = query.is_display * 1
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
// 商品id
|
|
|
getProductId(row) {
|
|
|
- console.log(row,'这个');
|
|
|
- this.modal_loading = false;
|
|
|
- this.modals = false;
|
|
|
- setTimeout(() => {
|
|
|
- this.formData.product_id = row.id
|
|
|
- this.formData.store_name = row.store_name
|
|
|
- this.formData.product_id = row.id
|
|
|
- this.formData.card_price = row.price
|
|
|
- this.formData.unit_name = row.unit_name
|
|
|
- this.formData.slider_image = row.image
|
|
|
- this.formData.price = row.price
|
|
|
- // this.formData.slider_image = row.slider_image
|
|
|
- // this.formData.is_show = 1
|
|
|
- this.formData.repertory = row.stock
|
|
|
- // this.formData.image = row.image
|
|
|
- }, 500);
|
|
|
+ console.log(row, '这个触发');
|
|
|
+ this.modal_loading = false;
|
|
|
+ this.modals = false;
|
|
|
+ // setTimeout(() => {
|
|
|
+ this.formData.product_id = row.id
|
|
|
+ this.formData.store_name = row.store_name
|
|
|
+ this.formData.product_id = row.id
|
|
|
+ this.formData.card_price = row.price
|
|
|
+ this.formData.unit_name = row.unit_name
|
|
|
+ this.formData.slider_image = row.image
|
|
|
+ this.formData.price = row.price
|
|
|
+ // this.formData.slider_image = row.slider_image
|
|
|
+ // this.formData.is_show = 1
|
|
|
+ this.formData.repertory = row.stock
|
|
|
+ // this.formData.image = row.image
|
|
|
+ // }, 500);
|
|
|
},
|
|
|
// 选择商品
|
|
|
changeGoods() {
|
|
|
- this.modals = true;
|
|
|
- },
|
|
|
- downTab() {
|
|
|
- // if (!this.formData.store_name) {
|
|
|
- // return this.$Message.error("请输入服务卡名称");
|
|
|
- // }
|
|
|
- // if (!this.formData.card_price) {
|
|
|
- // return this.$Message.error("请输入售价");
|
|
|
- // }
|
|
|
- // if (!this.formData.repertory) {
|
|
|
- // return this.$Message.error("请输入库存");
|
|
|
- // }
|
|
|
+ this.modals = true;
|
|
|
},
|
|
|
// 创建
|
|
|
save() {
|
|
|
- this.downTab();
|
|
|
- console.log('这');
|
|
|
+ console.log(this.formData,'这');
|
|
|
+ if (!this.formData.product_id) {
|
|
|
+ this.$Message.error("请先选择商品");
|
|
|
+ return
|
|
|
+ }
|
|
|
createServeProduct(this.formData.id, this.formData)
|
|
|
.then((res) => {
|
|
|
this.disabled = true;
|
|
@@ -195,61 +175,10 @@
|
|
|
this.$Message.error(err.msg);
|
|
|
});
|
|
|
},
|
|
|
- // 使用有效期--时间段
|
|
|
- dateChange(time) {
|
|
|
- this.formData.start_use_time = time[0];
|
|
|
- this.formData.end_use_time = time[1];
|
|
|
- },
|
|
|
// 限时
|
|
|
- timeChange(time) {
|
|
|
- this.formData.start_time = time[0];
|
|
|
- this.formData.end_time = time[1];
|
|
|
- },
|
|
|
- //对象数组去重;
|
|
|
- unique(arr) {
|
|
|
- const res = new Map();
|
|
|
- return arr.filter(
|
|
|
- (arr) => !res.has(arr.product_id) && res.set(arr.product_id, 1)
|
|
|
- );
|
|
|
- },
|
|
|
cancel() {
|
|
|
this.modals = false;
|
|
|
},
|
|
|
- // 删除商品
|
|
|
- remove(productId) {
|
|
|
- for (let index = 0; index < this.productList.length; index++) {
|
|
|
- if (this.productList[index].product_id == productId) {
|
|
|
- this.productList.splice(index, 1);
|
|
|
- }
|
|
|
- }
|
|
|
- this.formData.product_id = "";
|
|
|
- this.productList.forEach((value) => {
|
|
|
- if (this.formData.product_id) {
|
|
|
- this.formData.product_id += `,${value.product_id}`;
|
|
|
- } else {
|
|
|
- this.formData.product_id += `${value.product_id}`;
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
- // 获取详情
|
|
|
- getDetail() {
|
|
|
- serveReadApi(this.id).then(res => {
|
|
|
- console.log(res);
|
|
|
- let row = res.data.info.storeInfo
|
|
|
- this.formData = {
|
|
|
- id: row.id,
|
|
|
- product_id: row.id,
|
|
|
- store_name: row.store_name,
|
|
|
- card_price: row.card_price,
|
|
|
- explain: row.explain,
|
|
|
- unit_name: row.unit_name,
|
|
|
- image: row.image,
|
|
|
- images: row.slider_image,
|
|
|
- repertory: row.repertory,
|
|
|
- is_show: 1
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
},
|
|
|
};
|
|
|
</script>
|