Ver Fonte

2024-3-13

cmy há 1 ano atrás
pai
commit
b282e538b8

+ 492 - 509
src/components/goodsList/index.vue

@@ -1,530 +1,513 @@
 <template>
-  <div class="goodList">
-    <Form
-      ref="formValidate"
-      :model="formValidate"
-      :label-width="labelWidth"
-      :label-position="labelPosition"
-      inline
-      class="tabform"
-    >
-      <FormItem label="商品分类:" label-for="pid" v-if="!liveStatus">
-        <Cascader
-            :data="treeSelect"
-            placeholder="请选择商品分类"
-            change-on-select
-            filterable
-          class="input-add"
-            @on-change="treeSearchs"
-        ></Cascader>
-      </FormItem>
-      <FormItem label="商品标签:" label-for="pid" v-if="!liveStatus">
-          <Select
-            v-model="formValidate.store_label_id"
-            class="input-add"
-            clearable
-            @on-change="userSearchs"
-          >
-            <Option v-for="item in labelSelect" :value="item.id" :key="item.id"
-              >{{ item.label_name }}
-            </Option>
-          </Select>
-      </FormItem>
-      <FormItem label="商品搜索:" label-for="store_name">
-        <Input
-          placeholder="请输入商品名称,关键字,编号"
-          v-model="formValidate.store_name"
-          class="input-add mr14"
-        />
-        <Button type="primary" @click="userSearchs()">查询</Button>
-      </FormItem>
-    </Form>
-    <Table
-      ref="table"
-      no-data-text="暂无数据"
-      @on-select-all="selectAll"
-      @on-select-all-cancel="cancelAll"
-      @on-select="TableSelectRow"
-      @on-select-cancel="TableSelectCancelRow"
-      no-filtered-data-text="暂无筛选结果"
-      :columns="liveStatus == false ? columns4 : columns5"
-      :data="tableList"
-      :loading="loading"
-      class="mr-20"
-      height="500"
-    >
-      <template slot-scope="{ row }" slot="store_name">
-          <Tooltip max-width="200" placement="bottom">
-            <span class="line2">{{ row.store_name }}{{row.suk}}</span>
-            <p slot="content">{{ row.store_name }}{{row.suk}}</p>
-          </Tooltip>
-      </template>
-      <template slot-scope="{ row }" slot="image">
-        <viewer>
-          <div class="tabBox_img">
-            <img v-lazy="row.image" />
-          </div>
-        </viewer>
-      </template>
-	  <template slot-scope="{ row }" slot="product_type" v-if="row.hasOwnProperty('product_type')">
-	  	<span v-if="row.product_type==0">普通商品</span>
-	  	<span v-if="row.product_type==1">卡密商品</span>
-	  	<span v-if="row.product_type==3">虚拟商品</span>
-      <span v-if="row.product_type==4">次卡商品</span>
-	  <span v-if="row.product_type == 5">服务卡</span>
-	  <span v-if="row.product_type == 6">服务项目</span>
-	  </template>
-    </Table>
-    <div class="acea-row row-right page">
-      <Page
-        :total="total"
-        show-elevator
-        show-total
-        @on-change="pageChange"
-        :page-size="formValidate.limit"
-      />
-    </div>
-    <div class="footer" slot="footer" v-if="many === 'many' && !diy">
-      <Button
-        type="primary"
-        size="large"
-        :loading="modal_loading"
-        long
-        @click="ok"
-        >提交</Button
-      >
-    </div>
-  </div>
+	<div class="goodList">
+		<Form ref="formValidate" :model="formValidate" :label-width="labelWidth" :label-position="labelPosition" inline
+			class="tabform">
+			<FormItem label="商品分类:" label-for="pid" v-if="!liveStatus">
+				<Cascader :data="treeSelect" placeholder="请选择商品分类" change-on-select filterable class="input-add"
+					@on-change="treeSearchs"></Cascader>
+			</FormItem>
+			<FormItem label="商品标签:" label-for="pid" v-if="!liveStatus">
+				<Select v-model="formValidate.store_label_id" class="input-add" clearable @on-change="userSearchs">
+					<Option v-for="item in labelSelect" :value="item.id" :key="item.id">{{ item.label_name }}
+					</Option>
+				</Select>
+			</FormItem>
+			<FormItem label="选择门店:">
+				<Select v-model="formValidate.store_id" clearable filterable @on-change="userSearchs" class="input-add">
+					<Option v-for="item in staffData" :value="item.id" :key="item.id">{{ item.name }}
+					</Option>
+				</Select>
+			</FormItem>
+			<FormItem label="商品搜索:" label-for="store_name">
+				<Input placeholder="请输入商品名称,关键字,编号" v-model="formValidate.store_name" class="input-add mr14" />
+				<Button type="primary" @click="userSearchs()">查询</Button>
+			</FormItem>
+		</Form>
+		<Table ref="table" no-data-text="暂无数据" @on-select-all="selectAll" @on-select-all-cancel="cancelAll"
+			@on-select="TableSelectRow" @on-select-cancel="TableSelectCancelRow" no-filtered-data-text="暂无筛选结果"
+			:columns="liveStatus == false ? columns4 : columns5" :data="tableList" :loading="loading" class="mr-20"
+			height="500">
+			<template slot-scope="{ row }" slot="store_name">
+				<Tooltip max-width="200" placement="bottom">
+					<span class="line2">{{ row.store_name }}{{row.suk}}</span>
+					<p slot="content">{{ row.store_name }}{{row.suk}}</p>
+				</Tooltip>
+			</template>
+			<template slot-scope="{ row }" slot="image">
+				<viewer>
+					<div class="tabBox_img">
+						<img v-lazy="row.image" />
+					</div>
+				</viewer>
+			</template>
+			<template slot-scope="{ row }" slot="product_type" v-if="row.hasOwnProperty('product_type')">
+				<span v-if="row.product_type==0">普通商品</span>
+				<span v-if="row.product_type==1">卡密商品</span>
+				<span v-if="row.product_type==3">虚拟商品</span>
+				<span v-if="row.product_type==4">次卡商品</span>
+				<span v-if="row.product_type == 5">服务卡</span>
+				<span v-if="row.product_type == 6">服务项目</span>
+			</template>
+		</Table>
+		<div class="acea-row row-right page">
+			<Page :total="total" show-elevator show-total @on-change="pageChange" :page-size="formValidate.limit" />
+		</div>
+		<div class="footer" slot="footer" v-if="many === 'many' && !diy">
+			<Button type="primary" size="large" :loading="modal_loading" long @click="ok">提交</Button>
+		</div>
+	</div>
 </template>
 
 <script>
-import { mapState } from "vuex";
-import { cascaderListApi, changeListApi, allLabelApi } from "@/api/product";
-import { liveGoods } from "@/api/live";
-export default {
-  name: "index",
-  props: {
-	serviceProject: {
-		type: Number,
-		default: 0,
-	},
-	serviceCard: {
-		type: Number,
-		default: 0,
-	},
-	goodsType: {
-	  type: Number,
-	  default: 0,
-	  },
-    storeType: {
-      type: Number,
-      default: 0,
-    },
-    is_new: {
-      type: String,
-      default: "",
-    },
-    diy: {
-      type: Boolean,
-      default: false,
-    },
-    isdiy: {
-      type: Boolean,
-      default: false,
-    },
-    ischeckbox: {
-      type: Boolean,
-      default: false,
-    },
-    liveStatus: {
-      type: Boolean,
-      default: false,
-    },
-    isLive: {
-      type: Boolean,
-      default: false,
-    },
-    datas: {
-      type: Object,
-      default: function () {
-        return {};
-      },
-    },
-  },
-  data() {
-    return {
-      //选中商品集合
-      selectEquips:[],
-      // 选中的id集合
-      selectEquipsIds: [],
-      labelSelect:[],
-      cateIds:[],
-      modal_loading: false,
-      treeSelect: [],
-      formValidate: {
-		  service_project: this.serviceProject,
-		service_card: this.serviceCard,
-        page: 1,
-        limit: 10,
-        cate_id: "",
-        store_name: "",
-        is_new: this.is_new,
-		    store_label_id: ""
-      },
-      total: 0,
-      modals: false,
-      loading: false,
-      grid: {
-        xl: 10,
-        lg: 10,
-        md: 12,
-        sm: 24,
-        xs: 24,
-      },
-      tableList: [],
-      currentid: 0,
-      productRow: {},
-      columns4: [
-        {
-          title: "商品ID",
-          key: "id",
-		  minWidth: 60,
-        },
-        {
-          title: "图片",
-          slot: "image",
-          width:60,
-        },
-        {
-          title: "商品名称",
-          slot: "store_name",
-          minWidth: 200,
-        },
-		{
-		  title: "价格",
-		  key: "price",
-		  minWidth: 80,
+	import {
+		mapState
+	} from "vuex";
+	import {
+		cascaderListApi,
+		changeListApi,
+		allLabelApi
+	} from "@/api/product";
+	import {
+		liveGoods
+	} from "@/api/live";
+	import {
+		staffListInfo
+	} from "@/api/store";
+	export default {
+		name: "index",
+		props: {
+			serviceProject: {
+				type: Number,
+				default: 0,
+			},
+			serviceCard: {
+				type: Number,
+				default: 0,
+			},
+			goodsType: {
+				type: Number,
+				default: 0,
+			},
+			storeType: {
+				type: Number,
+				default: 0,
+			},
+			is_new: {
+				type: String,
+				default: "",
+			},
+			diy: {
+				type: Boolean,
+				default: false,
+			},
+			isdiy: {
+				type: Boolean,
+				default: false,
+			},
+			ischeckbox: {
+				type: Boolean,
+				default: false,
+			},
+			liveStatus: {
+				type: Boolean,
+				default: false,
+			},
+			isLive: {
+				type: Boolean,
+				default: false,
+			},
+			datas: {
+				type: Object,
+				default: function() {
+					return {};
+				},
+			},
 		},
-		{
-		  title: "商品类型",
-		  slot: "product_type",
-		  minWidth: 100,
+		data() {
+			return {
+				//选中商品集合
+				selectEquips: [],
+				// 选中的id集合
+				selectEquipsIds: [],
+				labelSelect: [],
+				cateIds: [],
+				modal_loading: false,
+				treeSelect: [],
+				formValidate: {
+					service_project: this.serviceProject,
+					service_card: this.serviceCard,
+					page: 1,
+					limit: 10,
+					cate_id: "",
+					store_name: "",
+					is_new: this.is_new,
+					store_label_id: "",
+					store_id: ''
+				},
+				total: 0,
+				modals: false,
+				loading: false,
+				grid: {
+					xl: 10,
+					lg: 10,
+					md: 12,
+					sm: 24,
+					xs: 24,
+				},
+				tableList: [],
+				currentid: 0,
+				productRow: {},
+				columns4: [{
+						title: "商品ID",
+						key: "id",
+						minWidth: 60,
+					},
+					{
+						title: "图片",
+						slot: "image",
+						width: 60,
+					},
+					{
+						title: "商品名称",
+						slot: "store_name",
+						minWidth: 200,
+					},
+					{
+						title: "价格",
+						key: "price",
+						minWidth: 80,
+					},
+					{
+						title: "商品类型",
+						slot: "product_type",
+						minWidth: 100,
+					},
+					{
+						title: "商品分类",
+						key: "cate_name",
+						minWidth: 150,
+					},
+				],
+				columns5: [{
+						title: "商品ID",
+						key: "id",
+					},
+					{
+						title: "图片",
+						slot: "image",
+					},
+					{
+						title: "商品名称",
+						key: "name",
+						minWidth: 250,
+					},
+				],
+				images: [],
+				many: "",
+			};
 		},
-        {
-          title: "商品分类",
-          key: "cate_name",
-          minWidth: 150,
-        },
-      ],
-      columns5: [
-        {
-          title: "商品ID",
-          key: "id",
-        },
-        {
-          title: "图片",
-          slot: "image",
-        },
-        {
-          title: "商品名称",
-          key: "name",
-          minWidth: 250,
-        },
-      ],
-      images: [],
-      many: "",
-    };
-  },
-  computed: {
-    ...mapState("admin/layout", ["isMobile"]),
-    labelWidth() {
-      return this.isMobile ? undefined : 120;
-    },
-    labelPosition() {
-      return this.isMobile ? "top" : "right";
-    },
-  },
-  created() {
-    let radio = {
-      title: "选择",
-      width: 70,
-      align: "center",
-      render: (h, params) => {
-        let id = params.row.id;
-        let flag = false;
-        if (this.currentid === id) {
-          flag = true;
-        } else {
-          flag = false;
-        }
-        let self = this;
-        return h("div", [
-          h("Radio", {
-            props: {
-              value: flag,
-            },
-            on: {
-              "on-change": () => {
-                self.currentid = id;
-                this.productRow = params.row;
-				console.log(this.productRow,'this.productRow');
-                this.$emit("getProductId", this.productRow);
-                if (this.productRow.id) {
-                  if (this.$route.query.fodder === "image") {
-                    /* eslint-disable */
-                    let imageObject = {
-                      image: this.productRow.image,
-                      product_id: this.productRow.id,
-                      name: this.productRow.name,
-                    };
-                    form_create_helper.set("image", imageObject);
-                    form_create_helper.close("image");
-                  }
-                } else {
-                  this.$Message.warning("请先选择商品");
-                }
-              },
-            },
-          }),
-        ]);
-      },
-    };
-
-    let checkbox = {
-      type: "selection",
-      width: 60,
-      align: "center",
-    };
-    let many = "";
-    if (this.ischeckbox) {
-      many = "many";
-    } else {
-      many = this.$route.query.type;
-    }
-    this.many = many;
-    if (many === "many") {
-      this.columns4.unshift(checkbox);
-      this.columns5.unshift(checkbox);
-    } else {
-      this.columns4.unshift(radio);
-      this.columns5.unshift(radio);
-    }
-  },
-  mounted() {
-    this.goodsCategory();
-    this.getList();
-		this.getAllLabelApi();
-  },
-  methods: {
-		// 判断是否选中
-		sortData() {
-			if (this.selectEquipsIds.length) {
-				this.tableList.forEach(ele => {
-					if (this.selectEquipsIds.includes(ele.id)) ele._checked = true;
-				})
-			}
-		},
-		// 选中一行
-		TableSelectRow(selection, row) {
-			if (!this.selectEquipsIds.includes(row.id)) {
-				this.selectEquipsIds.push(row.id);
-				this.selectEquips.push(row);
-			}
+		computed: {
+			...mapState("admin/layout", ["isMobile"]),
+			labelWidth() {
+				return this.isMobile ? undefined : 120;
+			},
+			labelPosition() {
+				return this.isMobile ? "top" : "right";
+			},
 		},
-		// 取消选中一行
-		TableSelectCancelRow(selection, row) {
-			var _index = this.selectEquipsIds.indexOf(row.id);
-			if (_index != -1) {
-				this.selectEquipsIds.splice(_index, 1);
-				this.selectEquips.splice(_index, 1);
+		created() {
+			let radio = {
+				title: "选择",
+				width: 70,
+				align: "center",
+				render: (h, params) => {
+					let id = params.row.id;
+					let flag = false;
+					if (this.currentid === id) {
+						flag = true;
+					} else {
+						flag = false;
+					}
+					let self = this;
+					return h("div", [
+						h("Radio", {
+							props: {
+								value: flag,
+							},
+							on: {
+								"on-change": () => {
+									self.currentid = id;
+									this.productRow = params.row;
+									console.log(this.productRow, 'this.productRow');
+									this.$emit("getProductId", this.productRow);
+									if (this.productRow.id) {
+										if (this.$route.query.fodder === "image") {
+											/* eslint-disable */
+											let imageObject = {
+												image: this.productRow.image,
+												product_id: this.productRow.id,
+												name: this.productRow.name,
+											};
+											form_create_helper.set("image", imageObject);
+											form_create_helper.close("image");
+										}
+									} else {
+										this.$Message.warning("请先选择商品");
+									}
+								},
+							},
+						}),
+					]);
+				},
+			};
+
+			let checkbox = {
+				type: "selection",
+				width: 60,
+				align: "center",
+			};
+			let many = "";
+			if (this.ischeckbox) {
+				many = "many";
+			} else {
+				many = this.$route.query.type;
 			}
-		},
-		// 选中所有
-		selectAll() {
-			for (let i = this.tableList.length - 1; i >= 0; i--) {
-				this.TableSelectRow(null, this.tableList[i]);
+			this.many = many;
+			if (many === "many") {
+				this.columns4.unshift(checkbox);
+				this.columns5.unshift(checkbox);
+			} else {
+				this.columns4.unshift(radio);
+				this.columns5.unshift(radio);
 			}
 		},
-		// 取消选中所有
-		cancelAll() {
-			for (let i = this.tableList.length - 1; i >= 0; i--) {
-				this.TableSelectCancelRow(null, this.tableList[i]);
-			}
-		},
-		getAllLabelApi () {
-			allLabelApi().then(res=>{
-				this.labelSelect = res.data
-			}).catch(err=>{
-				this.$Message.error(err.msg);
-			})
-		},
-		handleSelectAll () {
-		  this.$refs.table.selectAll(false);
-		},
-    // 商品分类;
-    goodsCategory() {
-      cascaderListApi(1)
-        .then((res) => {
-          this.treeSelect = res.data;
-        })
-        .catch((res) => {
-          this.$Message.error(res.msg);
-        });
-    },
-    pageChange(index) {
-      this.formValidate.page = index;
-      this.getList();
-    },
-    // 列表
-    getList() {
-      this.loading = true;
-      if (!this.liveStatus) {
-        if (this.isLive) {
-          this.formValidate.is_live = 1;
-        }
-		if(this.goodsType){
-			this.formValidate.is_presale_product = 0;
-			this.formValidate.is_vip_product = 0;
-		}
-    if(this.storeType){
-      this.formValidate.is_supplier = 0;
-    }
-	
-		this.formValidate.cate_id = this.cateIds[this.cateIds.length-1]
-        changeListApi(this.formValidate)
-          .then(async (res) => {
-            let data = res.data;
-            this.tableList = data.list;
-            this.total = res.data.count;
-			this.sortData();
-            this.loading = false;
-          })
-          .catch((res) => {
-            this.loading = false;
-            this.$Message.error(res.msg);
-          });
-      } else {
-        liveGoods({
-          is_show: "1",
-          status: "1",
-          live_id: this.datas.id,
-          kerword: this.formValidate.store_name,
-          page: this.formValidate.page,
-          limit: this.formValidate.limit,
-        })
-          .then(async (res) => {
-            let data = res.data;
-            data.list.forEach((el) => {
-              el.image = el.cover_img;
-            });
-            this.tableList = data.list;
-            this.total = res.data.count;
-			this.sortData();
-            this.loading = false;
-          })
-          .catch((res) => {
-            this.loading = false;
-            this.$Message.error(res.msg);
-          });
-      }
-    },
-		changeCheckbox(selection) {
-		  let images = [];
-		  selection.forEach(function (item) {
-		    let imageObject = {
-		      image: item.image,
-		      product_id: item.id,
-		      store_name: item.store_name,
-		      temp_id: item.temp_id
-		    };
-		    images.push(imageObject);
-		  });
-		  this.images = images;
-		  this.$emit("getProductDiy", selection);
-		},
-    ok() {
-			let images = [];
-			this.selectEquips.forEach(function (item) {
-			  let imageObject = {
-			    image: item.image,
-			    product_id: item.id,
-			    store_name: item.store_name,
-			    temp_id: item.temp_id
-			  };
-			  images.push(imageObject);
-			});
-      if (images.length > 0) {
-        if (this.$route.query.fodder === "image") {
-          let imageValue = form_create_helper.get("image");
-          form_create_helper.set("image", imageValue.concat(images));
-          form_create_helper.close("image");
-        } else {
-          if(this.isdiy){
-            this.$emit("getProductId", this.selectEquips);
-          }else {
-            this.$emit("getProductId", images);
-          }
-        }
-      } else {
-        this.$Message.warning("请先选择商品");
-      }
-    },
-		treeSearchs(value){
-			this.cateIds = value;
-			this.formValidate.page = 1;
+		mounted() {
+			this.goodsCategory();
 			this.getList();
+			this.getAllLabelApi();
+			this.staffList();
+		},
+		methods: {
+			// 门店列表
+			staffList() {
+				staffListInfo()
+					.then((res) => {
+						this.staffData = res.data;
+					})
+					.catch((err) => {
+						this.$Message.error(err.msg);
+					});
+			},
+			// 判断是否选中
+			sortData() {
+				if (this.selectEquipsIds.length) {
+					this.tableList.forEach(ele => {
+						if (this.selectEquipsIds.includes(ele.id)) ele._checked = true;
+					})
+				}
+			},
+			// 选中一行
+			TableSelectRow(selection, row) {
+				if (!this.selectEquipsIds.includes(row.id)) {
+					this.selectEquipsIds.push(row.id);
+					this.selectEquips.push(row);
+				}
+			},
+			// 取消选中一行
+			TableSelectCancelRow(selection, row) {
+				var _index = this.selectEquipsIds.indexOf(row.id);
+				if (_index != -1) {
+					this.selectEquipsIds.splice(_index, 1);
+					this.selectEquips.splice(_index, 1);
+				}
+			},
+			// 选中所有
+			selectAll() {
+				for (let i = this.tableList.length - 1; i >= 0; i--) {
+					this.TableSelectRow(null, this.tableList[i]);
+				}
+			},
+			// 取消选中所有
+			cancelAll() {
+				for (let i = this.tableList.length - 1; i >= 0; i--) {
+					this.TableSelectCancelRow(null, this.tableList[i]);
+				}
+			},
+			getAllLabelApi() {
+				allLabelApi().then(res => {
+					this.labelSelect = res.data
+				}).catch(err => {
+					this.$Message.error(err.msg);
+				})
+			},
+			handleSelectAll() {
+				this.$refs.table.selectAll(false);
+			},
+			// 商品分类;
+			goodsCategory() {
+				cascaderListApi(1)
+					.then((res) => {
+						this.treeSelect = res.data;
+					})
+					.catch((res) => {
+						this.$Message.error(res.msg);
+					});
+			},
+			pageChange(index) {
+				this.formValidate.page = index;
+				this.getList();
+			},
+			// 列表
+			getList() {
+				this.loading = true;
+				if (!this.liveStatus) {
+					if (this.isLive) {
+						this.formValidate.is_live = 1;
+					}
+					if (this.goodsType) {
+						this.formValidate.is_presale_product = 0;
+						this.formValidate.is_vip_product = 0;
+					}
+					if (this.storeType) {
+						this.formValidate.is_supplier = 0;
+					}
+
+					this.formValidate.cate_id = this.cateIds[this.cateIds.length - 1]
+					changeListApi(this.formValidate)
+						.then(async (res) => {
+							let data = res.data;
+							this.tableList = data.list;
+							this.total = res.data.count;
+							this.sortData();
+							this.loading = false;
+						})
+						.catch((res) => {
+							this.loading = false;
+							this.$Message.error(res.msg);
+						});
+				} else {
+					liveGoods({
+							is_show: "1",
+							status: "1",
+							live_id: this.datas.id,
+							kerword: this.formValidate.store_name,
+							page: this.formValidate.page,
+							limit: this.formValidate.limit,
+						})
+						.then(async (res) => {
+							let data = res.data;
+							data.list.forEach((el) => {
+								el.image = el.cover_img;
+							});
+							this.tableList = data.list;
+							this.total = res.data.count;
+							this.sortData();
+							this.loading = false;
+						})
+						.catch((res) => {
+							this.loading = false;
+							this.$Message.error(res.msg);
+						});
+				}
+			},
+			changeCheckbox(selection) {
+				let images = [];
+				selection.forEach(function(item) {
+					let imageObject = {
+						image: item.image,
+						product_id: item.id,
+						store_name: item.store_name,
+						temp_id: item.temp_id
+					};
+					images.push(imageObject);
+				});
+				this.images = images;
+				this.$emit("getProductDiy", selection);
+			},
+			ok() {
+				let images = [];
+				this.selectEquips.forEach(function(item) {
+					let imageObject = {
+						image: item.image,
+						product_id: item.id,
+						store_name: item.store_name,
+						temp_id: item.temp_id
+					};
+					images.push(imageObject);
+				});
+				if (images.length > 0) {
+					if (this.$route.query.fodder === "image") {
+						let imageValue = form_create_helper.get("image");
+						form_create_helper.set("image", imageValue.concat(images));
+						form_create_helper.close("image");
+					} else {
+						if (this.isdiy) {
+							this.$emit("getProductId", this.selectEquips);
+						} else {
+							this.$emit("getProductId", images);
+						}
+					}
+				} else {
+					this.$Message.warning("请先选择商品");
+				}
+			},
+			treeSearchs(value) {
+				this.cateIds = value;
+				this.formValidate.page = 1;
+				this.getList();
+			},
+			// 表格搜索
+			userSearchs() {
+				this.formValidate.page = 1;
+				this.getList();
+			},
+			clear() {
+				this.productRow.id = "";
+				this.currentid = "";
+			},
 		},
-		// 表格搜索
-    userSearchs() {
-      this.formValidate.page = 1;
-      this.getList();
-    },
-    clear() {
-      this.productRow.id = "";
-      this.currentid = "";
-    },
-  },
-};
+	};
 </script>
 
 <style scoped lang="stylus">
-/deep/.ivu-table-header thead tr th{
-  padding: 8px 5px;
-}
-/deep/.ivu-radio-wrapper{
-  margin-right: 0 !important;
-}
-.footer {
-  margin: 15px 0;
-}
+	/deep/.ivu-table-header thead tr th {
+		padding: 8px 5px;
+	}
+
+	/deep/.ivu-radio-wrapper {
+		margin-right: 0 !important;
+	}
 
-.tabBox_img {
-  width: 36px;
-  height: 36px;
-  border-radius: 4px;
-  cursor: pointer;
+	.footer {
+		margin: 15px 0;
+	}
 
-  img {
-    width: 100%;
-    height: 100%;
-  }
-}
+	.tabBox_img {
+		width: 36px;
+		height: 36px;
+		border-radius: 4px;
+		cursor: pointer;
 
-.tabform {
-  >>> .ivu-form-item {
-    margin-bottom: 16px !important;
-  }
-}
+		img {
+			width: 100%;
+			height: 100%;
+		}
+	}
+
+	.tabform {
+		>>>.ivu-form-item {
+			margin-bottom: 16px !important;
+		}
+	}
 
-.btn {
-  margin-top: 20px;
-  float: right;
-}
+	.btn {
+		margin-top: 20px;
+		float: right;
+	}
 
-.goodList {
+	.goodList {}
 
-}
-.mr-20{
-  margin-right:10px;
-}
-</style>
+	.mr-20 {
+		margin-right: 10px;
+	}
+</style>

+ 18 - 8
src/pages/marketing/serve/index.vue

@@ -16,6 +16,7 @@
 					<FormItem label="是否删除:" label-for="is_show">
 						<Select v-model="tableFrom.is_del" placeholder="请选择" clearable @on-change="userSearchs"
 							class="input-add">
+							<Option :value="-1">全部</Option>
 							<Option :value="0">正常</Option>
 							<Option :value="1">已删除</Option>
 						</Select>
@@ -49,12 +50,16 @@
 					<Icon type="md-checkmark" v-if="row.status === 1" color="#0092DC" size="14" />
 					<Icon type="md-close" v-else color="#ed5565" size="14" />
 				</template>
-				<template slot-scope="{ row, index }" slot="is_show">
+				<!-- <template slot-scope="{ row, index }" slot="is_show">
 					<span> {{row.is_show == 1 ?'显示': '隐藏'}}</span>
-				</template>
+				</template> -->
 				<template slot-scope="{ row, index }" slot="add_time">
 					<span> {{row.add_time }}</span>
 				</template>
+				<template slot-scope="{ row, index }" slot="type">
+					<span style="color: #19be6b;" v-if="row.is_del==0"> 正常</span>
+					<span style="color: #ff9900;" v-if="row.is_del==1"> 删除</span>
+				</template>
 				<template slot-scope="{ row, index }" slot="action">
 					<block v-if="tableFrom.is_del==0">
 						<a @click="bind(row)">绑定项目</a>
@@ -63,6 +68,11 @@
 						<Divider type="vertical" />
 						<a @click="couponDel(row,'删除服务卡',index)">删除</a>
 					</block>
+					<block v-else>
+						<a @click="bind(row)">绑定项目</a>
+						<Divider type="vertical" />
+						<a @click="couponSend(row)">编辑</a>
+					</block>
 				</template>
 			</Table>
 			<div class="acea-row row-right page">
@@ -146,11 +156,11 @@
 						key: 'discount',
 						minWidth: 100
 					},
-					// {
-					// 	title: '类型',
-					// 	key: 'type',
-					// 	minWidth: 100
-					// },
+					{
+						title: '状态',
+						slot: 'type',
+						minWidth: 80
+					},
 					{
 						title: '添加时间',
 						slot: 'add_time',
@@ -168,7 +178,7 @@
 					field_key: '',
 					page: 1,
 					limit: 15,
-					is_del: 0
+					is_del: -1
 				},
 				tableList: [],
 				total: 0,

+ 497 - 411
src/pages/store/components/addStore.vue

@@ -1,232 +1,273 @@
 <template>
-    <div>
-        <Modal v-model="isTemplate" scrollable  footer-hide closable :title="title"  :z-index="1" width="700" @on-cancel="cancel">
-            <div class="article-manager">
-                <Card :bordered="false" dis-hover>
-                    <Form ref="formItem" :model="formItem" :label-width="labelWidth" :label-position="labelPosition" :rules="ruleValidate" @submit.native.prevent>
-                        <Row type="flex" :gutter="24">
+	<div>
+		<Modal v-model="isTemplate" scrollable footer-hide closable :title="title" :z-index="1" width="700"
+			@on-cancel="cancel">
+			<div class="article-manager">
+				<Card :bordered="false" dis-hover>
+					<Form ref="formItem" :model="formItem" :label-width="labelWidth" :label-position="labelPosition"
+						:rules="ruleValidate" @submit.native.prevent>
+						<Row type="flex" :gutter="24">
 							<Col span="24" v-if="openErp">
-								<Col v-bind="grid">
-									<FormItem label="erp门店:" prop="erp_shop_id">
-										<Button @click="tapErp">{{formItem.erp_shop_id?formItem.erp_shop_id:"请选择erp门店"}}</Button>
-									</FormItem>
-								</Col>
+							<Col v-bind="grid">
+							<FormItem label="erp门店:" prop="erp_shop_id">
+								<Button
+									@click="tapErp">{{formItem.erp_shop_id?formItem.erp_shop_id:"请选择erp门店"}}</Button>
+							</FormItem>
+							</Col>
+							</Col>
+							<Col span="24">
+							<Col v-bind="grid">
+							<FormItem label="门店照片:" prop="image">
+								<div class="picBox" @click="modalPicTap('单选')">
+									<div class="pictrue" v-if="formItem.image"><img v-lazy="formItem.image"></div>
+									<div class="upLoad" v-else>
+										<div class="iconfont">+</div>
+									</div>
+								</div>
+							</FormItem>
+							</Col>
+							</Col>
+							
+							<Col span="24">
+							<Col v-bind="grid">
+							<FormItem label="邀请用户:" prop="image">
+								<Input v-model="formItem.uid" placeholder="请填写邀请用户UID" class="input-add mr14" />
+							</FormItem>
+							</Col>
 							</Col>
 							<Col span="24">
-							    <Col v-bind="grid">
-							        <FormItem label="门店照片:" prop="image">
-							            <div class="picBox" @click="modalPicTap('单选')">
-							                <div class="pictrue" v-if="formItem.image"><img v-lazy="formItem.image"></div>
-							                <div class="upLoad" v-else>
-												<div class="iconfont">+</div>
-							                </div>
-							            </div>
-							        </FormItem>
-							    </Col>
-							</Col>
-              <Col span="24">
-                 <Col v-bind="grid" >
-                    <FormItem label="门店分类:" prop="cate_id" label-for="cate_id">
-                      <Cascader
-                          :data="treeSelect"
-                          placeholder="请选择门店分类"
-                          change-on-select
-                          v-model="formItem.cate_id"
-                          filterable
-                      ></Cascader>
-                    </FormItem>
-                 </Col>
-              </Col>
+							<Col v-bind="grid">
+							<FormItem label="门店分类:" prop="cate_id" label-for="cate_id">
+								<Cascader :data="treeSelect" placeholder="请选择门店分类" change-on-select
+									v-model="formItem.cate_id" filterable></Cascader>
+							</FormItem>
+							</Col>
+							</Col>
+							<Col span="24" v-if="formItem.id == 0">
+							<Col v-bind="grid">
+							<FormItem label="管理员账号:" prop="store_account" label-for="store_account">
+								<Input v-model="formItem.store_account" placeholder="请输入管理员账号" />
+							</FormItem>
+							</Col>
+							</Col>
 							<Col span="24" v-if="formItem.id == 0">
-							    <Col v-bind="grid" >
-							        <FormItem label="管理员账号:" prop="store_account" label-for="store_account">
-							            <Input v-model="formItem.store_account"  placeholder="请输入管理员账号"/>
-							        </FormItem>
-							    </Col>
-							</Col>
-							<Col span="24"  v-if="formItem.id == 0">
-							    <Col v-bind="grid">
-							        <FormItem label="管理员密码:" prop="store_password" label-for="store_password">
-							            <Input type="password" v-model="formItem.store_password"  placeholder="请输入管理员密码"/>
-							        </FormItem>
-							    </Col>
-							</Col>
-                            <Col span="24">
-                                <Col v-bind="grid">
-                                    <FormItem label="门店名称:" prop="name" label-for="name">
-                                        <Input v-model="formItem.name"  maxlength="20" show-word-limit  placeholder="请输入门店名称"/>
-                                    </FormItem>
-                                </Col>
-                            </Col>
-                            <Col span="24">
-                            	<Col v-bind="grid">
-                            		<FormItem label="门店简介:" label-for="introduction">
-                            			<Input v-model="formItem.introduction"  maxlength="100" show-word-limit :rows="4" :autosize="{maxRows:4,minRows: 4}" type="textarea"   placeholder="请输入门店简介"s/>
-                            		</FormItem>
-                            	</Col>
-                            </Col>
-                            <Col span="24">
-                                <Col v-bind="grid">
-                                    <FormItem label="门店手机号:" label-for="phone" prop="phone">
-                                        <Input v-model="formItem.phone"  placeholder="请输入门店手机号"/>
-                                    </FormItem>
-                                </Col>
-                            </Col>
+							<Col v-bind="grid">
+							<FormItem label="管理员密码:" prop="store_password" label-for="store_password">
+								<Input type="password" v-model="formItem.store_password" placeholder="请输入管理员密码" />
+							</FormItem>
+							</Col>
+							</Col>
+							<Col span="24">
+							<Col v-bind="grid">
+							<FormItem label="门店名称:" prop="name" label-for="name">
+								<Input v-model="formItem.name" maxlength="20" show-word-limit placeholder="请输入门店名称" />
+							</FormItem>
+							</Col>
+							</Col>
+							<Col span="24">
+							<Col v-bind="grid">
+							<FormItem label="门店简介:" label-for="introduction">
+								<Input v-model="formItem.introduction" maxlength="100" show-word-limit :rows="4"
+									:autosize="{maxRows:4,minRows: 4}" type="textarea" placeholder="请输入门店简介" s />
+							</FormItem>
+							</Col>
+							</Col>
+							<Col span="24">
+							<Col v-bind="grid">
+							<FormItem label="门店手机号:" label-for="phone" prop="phone">
+								<Input v-model="formItem.phone" placeholder="请输入门店手机号" />
+							</FormItem>
+							</Col>
+							</Col>
 							<Col span="24">
-								<Col v-bind="grid">
-									<FormItem label="营业状态:" label-for="is_show" prop="is_show">
-										<Switch size="large" v-model="formItem.is_show" :false-value="0" :true-value="1">
-											<span slot="open" :true-value="1">开启</span>
-											<span slot="close" :false-value="0">关闭</span>
-										</Switch>
-									</FormItem>
-								</Col>
+							<Col v-bind="grid">
+							<FormItem label="营业状态:" label-for="is_show" prop="is_show">
+								<Switch size="large" v-model="formItem.is_show" :false-value="0" :true-value="1">
+									<span slot="open" :true-value="1">开启</span>
+									<span slot="close" :false-value="0">关闭</span>
+								</Switch>
+							</FormItem>
+							</Col>
 							</Col>
 							<Col span="24">
-								<Col v-bind="grid" v-if="formItem.is_show == 1">
-									<FormItem label="营业时间:" label-for="day_time"  prop="day_time">
-										<TimePicker type="timerange" @on-change="onchangeTime" v-model="formItem.day_time"  format="HH:mm:ss" :value="formItem.day_time" placement="bottom-end" placeholder="请选择营业时间" class="inputW" ></TimePicker>
-									</FormItem>
-								</Col>
-							</Col>
-              <Col span="24">
-                <Col v-bind="grid">
-                  <FormItem label="门店类型:">
-                    <RadioGroup v-model="formItem.type">
-                      <Radio :label="1">
-                        <Icon type="social-apple"></Icon>
-                        <span>自营</span>
-                      </Radio>
-                      <Radio :label="2">
-                        <Icon type="social-android"></Icon>
-                        <span>加盟</span>
-                      </Radio>
-                    </RadioGroup>
-                    <div class="tips">自营店不支持自主上传商品,加盟店有自主上传商品的权限</div>
-                  </FormItem>
-                </Col>
-              </Col>
+							<Col v-bind="grid" v-if="formItem.is_show == 1">
+							<FormItem label="营业时间:" label-for="day_time" prop="day_time">
+								<TimePicker type="timerange" @on-change="onchangeTime" v-model="formItem.day_time"
+									format="HH:mm:ss" :value="formItem.day_time" placement="bottom-end"
+									placeholder="请选择营业时间" class="inputW"></TimePicker>
+							</FormItem>
+							</Col>
+							</Col>
+							<Col span="24">
+							<Col v-bind="grid">
+							<FormItem label="门店类型:">
+								<RadioGroup v-model="formItem.type">
+									<Radio :label="1">
+										<Icon type="social-apple"></Icon>
+										<span>自营</span>
+									</Radio>
+									<Radio :label="2">
+										<Icon type="social-android"></Icon>
+										<span>加盟</span>
+									</Radio>
+								</RadioGroup>
+								<div class="tips">自营店不支持自主上传商品,加盟店有自主上传商品的权限</div>
+							</FormItem>
+							</Col>
+							</Col>
+							<Col span="24" v-if="formItem.type==2">
+							<Col v-bind="grid">
+							<FormItem label="商品免审:" label-for="product_verify_status" prop="product_verify_status">
+								<Switch size="large" v-model="formItem.product_verify_status" :false-value="0"
+									:true-value="1">
+									<span slot="open" :true-value="1">开启</span>
+									<span slot="close" :false-value="0">关闭</span>
+								</Switch>
+							</FormItem>
+							</Col>
+							</Col>
 							<Col span="24" v-if="formItem.type==2">
-								<Col v-bind="grid">
-									<FormItem label="商品免审:" label-for="product_verify_status" prop="product_verify_status">
-										<Switch size="large" v-model="formItem.product_verify_status" :false-value="0" :true-value="1">
-											<span slot="open" :true-value="1">开启</span>
-											<span slot="close" :false-value="0">关闭</span>
-										</Switch>
-									</FormItem>
-								</Col>
-							</Col>
-              <Col span="24" v-if="formItem.type==2">
-                <Col v-bind="grid">
-                  <FormItem label="自主添加商品:" label-for="product_status" prop="product_status">
-                    <Switch size="large" v-model="formItem.product_status" :false-value="0" :true-value="1">
-                      <span slot="open" :true-value="1">开启</span>
-                      <span slot="close" :false-value="0">关闭</span>
-                    </Switch>
-                  </FormItem>
-                </Col>
-              </Col>
+							<Col v-bind="grid">
+							<FormItem label="自主添加商品:" label-for="product_status" prop="product_status">
+								<Switch size="large" v-model="formItem.product_status" :false-value="0" :true-value="1">
+									<span slot="open" :true-value="1">开启</span>
+									<span slot="close" :false-value="0">关闭</span>
+								</Switch>
+							</FormItem>
+							</Col>
+							</Col>
+							<Col span="24">
+							<Col v-bind="grid">
+							<FormItem label="到店自提:" label-for="mention" prop="mention">
+								<Switch size="large" v-model="formItem.is_store" :false-value="0" :true-value="1">
+									<span slot="open" :true-value="1">开启</span>
+									<span slot="close" :false-value="0">关闭</span>
+								</Switch>
+							</FormItem>
+							</Col>
+							</Col>
 							<Col span="24">
-								<Col v-bind="grid">
-									<FormItem label="到店自提:" label-for="mention" prop="mention">
-										<Switch size="large" v-model="formItem.is_store" :false-value="0" :true-value="1">
-											<span slot="open" :true-value="1">开启</span>
-											<span slot="close" :false-value="0">关闭</span>
-										</Switch>
-									</FormItem>
-								</Col>
-							</Col>
-                            <Col span="24">
-                            	<Col v-bind="grid">
-                            		<FormItem label="门店地址:" label-for="address" prop="address">
-                            			<Cascader :data="addresData" :load-data="loadData" v-model="formItem.addressSelect" @on-change="addchack" class="inputW"></Cascader>
-                            		</FormItem>
-                            	</Col>
-                            </Col>
+							<Col v-bind="grid">
+							<FormItem label="门店地址:" label-for="address" prop="address">
+								<Cascader :data="addresData" :load-data="loadData" v-model="formItem.addressSelect"
+									@on-change="addchack" class="inputW"></Cascader>
+							</FormItem>
+							</Col>
+							</Col>
+							<Col span="24">
+							<Col v-bind="grid">
+							<FormItem required label="配送范围(半径):" label-for="valid_range" prop="valid_range">
+								<InputNumber :min="0.01" :max="100000" v-model="formItem.valid_range"
+									:formatter="value => `${formItem.valid_range}`"
+									:parser="value => value.replace('%', '')" style="width: 90px;"></InputNumber><span
+									class="ml10">km</span>
+							</FormItem>
+							</Col>
+							</Col>
 							<Col span="24">
-								<Col v-bind="grid">
-									<FormItem required label="配送范围(半径):" label-for="valid_range" prop="valid_range">
-										<InputNumber :min="0.01" :max="100000" v-model="formItem.valid_range" :formatter="value => `${formItem.valid_range}`" :parser="value => value.replace('%', '')" style="width: 90px;"></InputNumber><span class="ml10">km</span>
-									</FormItem>
-								</Col>
-							</Col>
-                            <Col span="24">
-                            	<Col v-bind="grid">
-                            		<FormItem label="门店详细地址:" label-for="detailed_address" prop="detailed_address">
-                            			<Input search enter-button="查找位置" v-model="formItem.detailed_address"  placeholder="输入地址(包含城市名称,否则会影响搜索精度)" class="inputW" @on-search="onSearch" />
-                            		  <!-- 提示:定位地址后,手动补充完详细地址,禁止再次点击查找 -->
-									</FormItem>
-                            	</Col>
-                            </Col>
+							<Col v-bind="grid">
+							<FormItem label="门店详细地址:" label-for="detailed_address" prop="detailed_address">
+								<Input search enter-button="查找位置" v-model="formItem.detailed_address"
+									placeholder="输入地址(包含城市名称,否则会影响搜索精度)" class="inputW" @on-search="onSearch" />
+								<!-- 提示:定位地址后,手动补充完详细地址,禁止再次点击查找 -->
+							</FormItem>
+							</Col>
+							</Col>
 							<Col span="24" v-if="isApi || add">
-								<Maps v-if="mapKey" ref="mapChild" class="map-sty" :mapKey="mapKey" :lat="Number(formItem.latitude || 34.34127)" :lon="Number(formItem.longitude || 108.93984)" :address="formItem.detailed_address" @getCoordinates="getCoordinates" />
-							</Col>
-                          <Col span="24" class="mt20" v-if="!formItem.id">
-                            <Col v-bind="grid">
-                              <FormItem label="同步商品:">
-                                <RadioGroup v-model="formItem.applicable_type">
-                                  <Radio :label="1">
-                                    <Icon type="social-apple"></Icon>
-                                    <span>全部商品</span>
-                                  </Radio>
-                                  <Radio :label="2">
-                                    <Icon type="social-android"></Icon>
-                                    <span>部分商品</span>
-                                  </Radio>
-                                </RadioGroup>
-                              </FormItem>
-                            </Col>
-                          </Col>
-                          <Col span="24" v-if="!formItem.id && formItem.applicable_type == 2" >
-                          <FormItem label="选择商品:" label-for="product_id" prop="">
-                            <div class="box">
-                              <div class="box-item" v-for="(item,index) in goodsList" :key="index">
-                                <img :src="item.image" alt="">
-                                <Icon class="icon" type="ios-close-circle" size="20" @click="bindDelete(index)" />
-                              </div>
-                              <div class="upload-box" @click="modals = true"><Icon type="ios-camera-outline" size="36" /></div>
-                            </div>
-                          </FormItem>
-                        </Col>
-                        </Row>
-                        <Row style="justify-content: space-around;">
-                            <Col>
-                                <Button type="primary" class="btn" @click="handleSubmit('formItem')">{{formItem.id!=0?'修改':'提交'}}</Button>
-                            </Col>
-                        </Row>
-                        <Spin size="large" fix v-if="spinShow"></Spin>
-                    </Form>
-                </Card>
+							<Maps v-if="mapKey" ref="mapChild" class="map-sty" :mapKey="mapKey"
+								:lat="Number(formItem.latitude || 34.34127)"
+								:lon="Number(formItem.longitude || 108.93984)" :address="formItem.detailed_address"
+								@getCoordinates="getCoordinates" />
+							</Col>
+							<Col span="24" class="mt20" v-if="!formItem.id">
+							<Col v-bind="grid">
+							<FormItem label="同步商品:">
+								<RadioGroup v-model="formItem.applicable_type">
+									<Radio :label="1">
+										<Icon type="social-apple"></Icon>
+										<span>全部商品</span>
+									</Radio>
+									<Radio :label="2">
+										<Icon type="social-android"></Icon>
+										<span>部分商品</span>
+									</Radio>
+								</RadioGroup>
+							</FormItem>
+							</Col>
+							</Col>
+							<Col span="24" v-if="!formItem.id && formItem.applicable_type == 2">
+							<FormItem label="选择商品:" label-for="product_id" prop="">
+								<div class="box">
+									<div class="box-item" v-for="(item,index) in goodsList" :key="index">
+										<img :src="item.image" alt="">
+										<Icon class="icon" type="ios-close-circle" size="20"
+											@click="bindDelete(index)" />
+									</div>
+									<div class="upload-box" @click="modals = true">
+										<Icon type="ios-camera-outline" size="36" />
+									</div>
+								</div>
+							</FormItem>
+							</Col>
+						</Row>
+						<Row style="justify-content: space-around;">
+							<Col>
+							<Button type="primary" class="btn"
+								@click="handleSubmit('formItem')">{{formItem.id!=0?'修改':'提交'}}</Button>
+							</Col>
+						</Row>
+						<Spin size="large" fix v-if="spinShow"></Spin>
+					</Form>
+				</Card>
 
-                <Modal v-model="modalPic" width="960px" scrollable  footer-hide closable title='上传提货点logo' :mask-closable="false" :z-index="1">
-                    <uploadPictures :isChoice="isChoice" @getPic="getPic" :gridBtn="gridBtn" :gridPic="gridPic" v-if="modalPic"></uploadPictures>
-                </Modal>
-				<Modal v-model="modalErp" width="700px" scrollable  footer-hide closable title='erp门店' :mask-closable="false" :z-index="1">
+				<Modal v-model="modalPic" width="960px" scrollable footer-hide closable title='上传提货点logo'
+					:mask-closable="false" :z-index="1">
+					<uploadPictures :isChoice="isChoice" @getPic="getPic" :gridBtn="gridBtn" :gridPic="gridPic"
+						v-if="modalPic"></uploadPictures>
+				</Modal>
+				<Modal v-model="modalErp" width="700px" scrollable footer-hide closable title='erp门店'
+					:mask-closable="false" :z-index="1">
 					<erpList ref="refErp" @getProductId="getProductId"></erpList>
 				</Modal>
-            </div>
-        </Modal>
-        <Modal v-model="modals" title="商品列表"  class="paymentFooter" scrollable width="900" :footer-hide="true">
-          <goods-list ref="goodslist"  @getProductId="getGoodsId" v-if="modals" :ischeckbox="true" :isLive="true" :storeType="1"></goods-list>
-        </Modal>
-    </div>
+			</div>
+		</Modal>
+		<Modal v-model="modals" title="商品列表" class="paymentFooter" scrollable width="900" :footer-hide="true">
+			<goods-list ref="goodslist" @getProductId="getGoodsId" v-if="modals" :ischeckbox="true" :isLive="true"
+				:storeType="1"></goods-list>
+		</Modal>
+	</div>
 </template>
 
 <script>
 	// import { keyApi} from '@/api/setting';
-  import goodsList from '@/components/goodsList'
-	import { keyApi, storeGetInfoApi, cityApi, storeUpdateApi, cascaderList } from '@/api/store';
-	import { erpConfig } from "@/api/erp";
+	import goodsList from '@/components/goodsList'
+	import {
+		keyApi,
+		storeGetInfoApi,
+		cityApi,
+		storeUpdateApi,
+		cascaderList
+	} from '@/api/store';
+	import {
+		erpConfig
+	} from "@/api/erp";
 	// import { keyApi, storeUpdateApi, storeGetInfoApi, cityApi } from '@/api/setting';
-	import { mapState } from 'vuex';
+	import {
+		mapState
+	} from 'vuex';
 	import uploadPictures from '@/components/uploadPictures';
 	import erpList from './erpList.vue';
 	import Maps from '@/components/map/map.vue'
 	export default {
 		name: 'systemStore',
-		components: { uploadPictures,Maps,erpList,goodsList },
-		props: { },
-		data () {
+		components: {
+			uploadPictures,
+			Maps,
+			erpList,
+			goodsList
+		},
+		props: {},
+		data() {
 			let validatePhone = (rule, value, callback) => {
 				if (!value) {
 					return callback(new Error('请填写联系号码'));
@@ -249,16 +290,16 @@
 				}
 			};
 			return {
-        goodsList:[],
-        modals:false,
-        treeSelect:[],
-				modalErp:false,
-				openErp:false,
+				goodsList: [],
+				modals: false,
+				treeSelect: [],
+				modalErp: false,
+				openErp: false,
 				isTemplate: false,
 				title: '',
 				formItem: {
-          product_id:[],
-          cate_id:[],
+					product_id: [],
+					cate_id: [],
 					id: 0,
 					erp_shop_id: 0,
 					store_account: '',
@@ -272,58 +313,78 @@
 					is_store: 0,
 					address: '',
 					detailed_address: '',
-					latitude:'',
-					longitude:'',
-					province:0,
-					city:0,
-					area:0,
-					street:0,
-					addressSelect:[],
-					valid_range:0,
-					product_verify_status:0,
-          product_status:1,
-          type:1,
-          applicable_type:1
+					latitude: '',
+					longitude: '',
+					province: 0,
+					city: 0,
+					area: 0,
+					street: 0,
+					addressSelect: [],
+					valid_range: 0,
+					product_verify_status: 0,
+					product_status: 1,
+					type: 1,
+					applicable_type: 1
 				},
 				spinShow: false,
 				addresData: [],
 				ruleValidate: {
-					name: [
-						{ required: true, message: '请输入门店名称', trigger: 'blur' }
-					],
-					erp_shop_id: [
-						{ required: true, validator: validateErp, trigger: 'change' }
-					],
-					store_account: [
-						{ required: true, message: '请输入管理员账号', trigger: 'blur' }
-					],
-					store_password: [
-						{ required: true, message: '请输入管理员密码', trigger: 'blur' }
-					],
-					address: [
-						{ required: true, message: '请选择门店地址', trigger: 'change' }
-					],
-					day_time: [ 
-						{required: true,type: "array", message: "请选择营业时间",trigger: "change"},
-						{validator(rule, value, callback, source, options) 
-							{
+					name: [{
+						required: true,
+						message: '请输入门店名称',
+						trigger: 'blur'
+					}],
+					erp_shop_id: [{
+						required: true,
+						validator: validateErp,
+						trigger: 'change'
+					}],
+					store_account: [{
+						required: true,
+						message: '请输入管理员账号',
+						trigger: 'blur'
+					}],
+					store_password: [{
+						required: true,
+						message: '请输入管理员密码',
+						trigger: 'blur'
+					}],
+					address: [{
+						required: true,
+						message: '请选择门店地址',
+						trigger: 'change'
+					}],
+					day_time: [{
+							required: true,
+							type: "array",
+							message: "请选择营业时间",
+							trigger: "change"
+						},
+						{
+							validator(rule, value, callback, source, options) {
 								if (value[0] === "") {
-								callback("时间不能为空");
+									callback("时间不能为空");
 								}
-							 callback();//这个一定要有。不然无法验证通过
+								callback(); //这个一定要有。不然无法验证通过
 							}
 						}
-				    ],//TimePicker-timerange,自定义的
+					], //TimePicker-timerange,自定义的
 
-					phone: [
-						{ required: true, validator: validatePhone, trigger: 'blur' }
-					],
-					detailed_address: [
-						{ required: true, message: '请输入详细地址', trigger: 'blur' }
-					],
-					image: [
-						{ required: true, validator: validateUpload, trigger: 'change' }
-					]
+					phone: [{
+						required: true,
+						validator: validatePhone,
+						trigger: 'blur'
+					}],
+					detailed_address: [{
+						required: true,
+						message: '请输入详细地址',
+						trigger: 'blur'
+					}],
+					image: [{
+						required: true,
+						validator: validateUpload,
+						trigger: 'change'
+					}]
 				},
 				mapKey: '',
 				grid: {
@@ -349,84 +410,86 @@
 				},
 				modalPic: false,
 				isChoice: '单选',
-				pid:0,
-				isApi:0,
-				add:0
+				pid: 0,
+				isApi: 0,
+				add: 0
 			}
 		},
-		created () {
-      this.goodsCategory();
+		created() {
+			this.goodsCategory();
 			this.getErpConfig();
 			this.getKey();
 			// this.getInfo();
-			let data = {pid:0}
+			let data = {
+				pid: 0
+			}
 			this.cityInfo(data);
 		},
 		computed: {
 			...mapState('admin/layout', [
 				'isMobile'
 			]),
-			labelWidth () {
+			labelWidth() {
 				return this.isMobile ? undefined : 120;
 			},
-			labelPosition () {
+			labelPosition() {
 				return this.isMobile ? 'top' : 'right';
 			}
 		},
-		mounted: function () {},
+		mounted: function() {},
 		methods: {
-      //对象数组去重;
-      unique(arr) {
-        const res = new Map();
-        return arr.filter((arr) => !res.has(arr.product_id) && res.set(arr.product_id, 1))
-      },
-      getGoodsId (data) {
-        let list = this.goodsList.concat(data);
-        let uni = this.unique(list);
-        this.goodsList = uni;
-        this.$nextTick(res=>{
-          setTimeout(()=>{
-            this.modals = false
-          },300)
-        })
-      },
-      bindDelete (index) {
-        this.goodsList.splice(index, 1)
-      },
-      // 门店分类;
-      goodsCategory () {
-        cascaderList(1).then(res => {
-          this.treeSelect = res.data;
-        }).catch(res => {
-          this.$Message.error(res.msg);
-        })
-      },
-			getProductId(id){
+			//对象数组去重;
+			unique(arr) {
+				const res = new Map();
+				return arr.filter((arr) => !res.has(arr.product_id) && res.set(arr.product_id, 1))
+			},
+			getGoodsId(data) {
+				let list = this.goodsList.concat(data);
+				let uni = this.unique(list);
+				this.goodsList = uni;
+				this.$nextTick(res => {
+					setTimeout(() => {
+						this.modals = false
+					}, 300)
+				})
+			},
+			bindDelete(index) {
+				this.goodsList.splice(index, 1)
+			},
+			// 门店分类;
+			goodsCategory() {
+				cascaderList(1).then(res => {
+					this.treeSelect = res.data;
+				}).catch(res => {
+					this.$Message.error(res.msg);
+				})
+			},
+			getProductId(id) {
 				this.formItem.erp_shop_id = id;
 				this.modalErp = false;
 				this.$refs.formItem.validateField("erp_shop_id");
 			},
-			tapErp(){
+			tapErp() {
 				this.$refs.refErp.currentid = this.formItem.erp_shop_id;
 				this.modalErp = true;
 				this.$refs.formItem.validateField("erp_shop_id");
 			},
-			getErpConfig(){
-				erpConfig().then(res=>{
+			getErpConfig() {
+				erpConfig().then(res => {
 					this.openErp = res.data.open_erp;
-				}).catch(err=>{
+				}).catch(err => {
 					this.$Message.error(err.msg);
 				})
 			},
-			clearFrom () {
-          this.goodsList = [];
-			    this.formItem = {
-          cate_id: [],
+			clearFrom() {
+				this.goodsList = [];
+				this.formItem = {
+					cate_id: [],
 					id: 0,
 					store_account: '',
 					store_password: "",
 					image: '',
-					erp_shop_id:0,
+					erp_shop_id: 0,
 					name: '',
 					introduction: '',
 					phone: '',
@@ -435,49 +498,51 @@
 					is_store: 0,
 					address: '',
 					detailed_address: '',
-					latitude:'',
-					longitude:'',
-					province:0,
-					city:0,
-					area:0,
-					street:0,
-					addressSelect:[],
-					valid_range:0,
-          product_verify_status:0,
-          product_status:1,
-          type:1,
-          applicable_type:1
+					latitude: '',
+					longitude: '',
+					province: 0,
+					city: 0,
+					area: 0,
+					street: 0,
+					addressSelect: [],
+					valid_range: 0,
+					product_verify_status: 0,
+					product_status: 1,
+					type: 1,
+					applicable_type: 1
 				}
 				this.add = 0;
 				this.isApi = 0;
 			},
-			cancel () {
+			cancel() {
 				this.isTemplate = false;
-			    // this.$refs['formItem'].resetFields();
-			    this.clearFrom();
+				// this.$refs['formItem'].resetFields();
+				this.clearFrom();
 			},
-			addchack(e,selectedData){
-				e.forEach((i,index)=>{
-					if(index==0){
+			addchack(e, selectedData) {
+				e.forEach((i, index) => {
+					if (index == 0) {
 						this.formItem.province = i
-					}else if(index==1){
+					} else if (index == 1) {
 						this.formItem.city = i
-					}else if(index==2){
+					} else if (index == 2) {
 						this.formItem.area = i
-					}else {
+					} else {
 						this.formItem.street = i
 					}
 				})
 				this.formItem.address = (selectedData.map(o => o.label)).join("/");
 			},
-			cityInfo(data){
-				cityApi(data).then(res=>{
+			cityInfo(data) {
+				cityApi(data).then(res => {
 					this.addresData = res.data
 				})
 			},
 			loadData(item, callback) {
 				item.loading = true;
-				cityApi({pid:item.value}).then(res=>{
+				cityApi({
+					pid: item.value
+				}).then(res => {
 					item.children = res.data;
 					item.loading = false;
 					callback();
@@ -487,22 +552,22 @@
 			getCoordinates(data) {
 				this.formItem.latitude = data.location.lat || 34.34127
 				this.formItem.longitude = data.location.lng || 108.93984
-				if(this.isApi){
+				if (this.isApi) {
 					// // this.formItem.detailed_address = data.address
 					let components = data.addressComponents;
-					if(this.formItem.detailed_address.indexOf(components.street) == -1){
-						this.formItem.detailed_address = data.address+(components.town?components.town:'');
+					if (this.formItem.detailed_address.indexOf(components.street) == -1) {
+						this.formItem.detailed_address = data.address + (components.town ? components.town : '');
 					}
 				}
 			},
 			// 查找位置
 			onSearch() {
-				if(this.$refs.mapChild){
+				if (this.$refs.mapChild) {
 					this.$refs.mapChild.searchKeyword(this.formItem.detailed_address)
 				}
 			},
 			// key值
-			getKey () {
+			getKey() {
 				keyApi().then(res => {
 					this.mapKey = res.data.key
 				}).catch(res => {
@@ -510,12 +575,12 @@
 				})
 			},
 			// 详情
-			getInfo (id) {
-			    let that = this;
-          that.$refs['formItem'].resetFields();
-			    that.formItem.id = id;
-			    that.spinShow = true;
-			    storeGetInfoApi(id).then(res => {
+			getInfo(id) {
+				let that = this;
+				that.$refs['formItem'].resetFields();
+				that.formItem.id = id;
+				that.spinShow = true;
+				storeGetInfoApi(id).then(res => {
 					this.isApi = 1;
 					let addressSelect = [];
 					this.formItem = res.data.info;
@@ -524,59 +589,59 @@
 					a.push(res.data.info.day_start)
 					a.push(res.data.info.day_end)
 					this.formItem.day_time = a
-					if(res.data.info.province){
+					if (res.data.info.province) {
 						addressSelect.push(res.data.info.province)
 					}
-					if(res.data.info.city){
+					if (res.data.info.city) {
 						addressSelect.push(res.data.info.city)
 					}
-					if(res.data.info.area){
+					if (res.data.info.area) {
 						addressSelect.push(res.data.info.area)
 					}
-					if(res.data.info.street){
+					if (res.data.info.street) {
 						addressSelect.push(res.data.info.street)
 					}
-					this.$set(this.formItem,'valid_range',(this.formItem.valid_range)/1000)
+					this.$set(this.formItem, 'valid_range', (this.formItem.valid_range) / 1000)
 					this.formItem.addressSelect = addressSelect;
 					this.onSearch();
 					that.spinShow = false;
-				}).catch(function (res) {
+				}).catch(function(res) {
 					that.spinShow = false;
 					that.$Message.error(res.msg);
 				})
 			},
 			// 选择图片
-			modalPicTap () {
+			modalPicTap() {
 				this.modalPic = true;
 				this.$refs.formItem.validateField("image")
 			},
 			// 选中图片
-			getPic (pc) {
+			getPic(pc) {
 				this.formItem.image = pc.att_dir;
 				this.modalPic = false;
 				this.$refs.formItem.validateField("image")
 			},
 			// 营业时间
-			onchangeTime (e) {
+			onchangeTime(e) {
 				this.formItem.day_time = e;
 			},
 			// 提交
-			handleSubmit (name) {
+			handleSubmit(name) {
 				this.$refs[name].validate((valid) => {
 					if (valid) {
-						if(this.formItem.day_time[0] == ''){
+						if (this.formItem.day_time[0] == '') {
 							this.formItem.day_time = ['00:00:00', '23:59:59']
 						}
-						if(this.formItem.valid_range == ''||this.formItem.valid_range<0){
+						if (this.formItem.valid_range == '' || this.formItem.valid_range < 0) {
 							return this.$Message.error('请输入有效的门店范围');
 						}
-            let product_id = []
-            this.goodsList.forEach(item=>{
-              product_id.push(item.product_id)
-            })
-            this.formItem.product_id = product_id;
-            // this.formItem.valid_range = this.formItem.valid_range/1000
-						storeUpdateApi(this.formItem.id,this.formItem).then(async res => {
+						let product_id = []
+						this.goodsList.forEach(item => {
+							product_id.push(item.product_id)
+						})
+						this.formItem.product_id = product_id;
+						// this.formItem.valid_range = this.formItem.valid_range/1000
+						storeUpdateApi(this.formItem.id, this.formItem).then(async res => {
 							this.$Message.success(res.msg);
 							this.isTemplate = false;
 							this.$parent.getList();
@@ -589,95 +654,116 @@
 						return false;
 					}
 				})
-				
+
 			}
 		}
 	}
 </script>
 
 <style scoped lang="stylus">
-.tips {
-  display: inline-bolck;
-  font-size: 12px;
-  font-weight: 400;
-  color: #999;
-}
-.box{
-  display flex
-  flex-wrap wrap
-  .box-item{
-    position relative
-    margin-right 20px
-    width 60px
-    height 60px
-    margin-bottom 10px
-    img{
-      width 100%
-      height 100%
-    }
-    .icon{
-      position absolute;
-      top:-10px;
-      right -10px;
-    }
-  }
-  .upload-box{
-    width 60px
-    height 60px
-    margin-bottom 10px
-    display flex
-    align-items center
-    justify-content center
-    background #ccc
-  }
-}
+	.tips {
+		display: inline-bolck;
+		font-size: 12px;
+		font-weight: 400;
+		color: #999;
+	}
+
+	.box {
+		display: flex;
+		flex-wrap: wrap;
+
+		.box-item {
+			position: relative;
+			margin-right: 20px;
+			width: 60px;
+			height: 60px;
+			margin-bottom: 10px;
+
+			img {
+				width: 100%;
+				height: 100%;
+			}
+
+			.icon {
+				position: absolute;
+				top: -10px;
+				right: -10px;
+			}
+		}
+
+		.upload-box {
+			width: 60px;
+			height: 60px;
+			margin-bottom: 10px;
+			display: flex;
+			align-items: center;
+			justify-content: center;
+			background: #ccc;
+		}
+	}
+
 	.map-sty {
 		width: 90%;
 		text-align: right;
 		margin: 0 0 0 10%;
 	}
-	/deep/.ivu-card-body{
-		padding 16px 0 0 0!important;
+
+	/deep/.ivu-card-body {
+		padding: 16px 0 0 0 !important;
 	}
-	.footer{
-		width 100%;
-		height 50px;
+
+	.footer {
+		width: 100%;
+		height: 50px;
 		box-shadow: 0px -2px 4px 0px rgba(0, 0, 0, 0.05);
-		margin-top 50px;
+		margin-top: 50px;
 	}
-.btn /deep/.ivu-btn-primary{
-		width 86px;
+
+	.btn /deep/.ivu-btn-primary {
+		width: 86px;
 	}
-	.btn{
+
+	.btn {
 		margin-top: 20px;
 	}
-	.inputW{
-		width 400px;
+
+	.inputW {
+		width: 400px;
 	}
-	.ivu-mt{
-		min-width 580px;
+
+	.ivu-mt {
+		min-width: 580px;
 	}
-	.picBox
+
+	.picBox {
 		display: inline-block;
 		cursor: pointer;
-		.upLoad
+
+		.upLoad {
 			width: 58px;
 			height: 58px;
 			line-height: 58px;
 			border: 1px dotted rgba(0, 0, 0, 0.1);
 			border-radius: 4px;
 			background: rgba(0, 0, 0, 0.02);
-		.pictrue
+		}
+
+		.pictrue {
 			width: 60px;
 			height: 60px;
 			border: 1px dotted rgba(0, 0, 0, 0.1);
 			margin-right: 10px;
-			img
+
+			img {
 				width: 100%;
 				height: 100%;
-		.iconfont
+			}
+		}
+
+		.iconfont {
 			color: #CCCCCC;
-			font-size 26px;
-			text-align center
-			
-</style>
+			font-size: 26px;
+			text-align: center;
+		}
+	}
+</style>

+ 49 - 6
src/pages/user/list/handle/userDetails.vue

@@ -105,7 +105,7 @@
 								<div class="image" v-viewer>
 									<img v-lazy="item.product.image">
 								</div>
-								<div class="title">
+								<div class="title" v-if="item.type==1">
 									<div>
 										{{ item.product.store_name }}
 									</div>
@@ -119,6 +119,30 @@
 										剩余次数:{{ item.repertory }}
 									</div>
 								</div>
+								<div class="title" v-if="item.type==2">
+									<div>
+										{{ item.product.store_name }}
+									</div>
+									<div>
+										ID:{{item.product.id}}
+									</div>
+									<div class="flex">
+										<div>
+											原价:{{ item.product.price }}
+										</div>
+										<div>
+											剩余次数:{{ item.repertory }}
+										</div>
+									</div>
+									<div class="flex">
+										<div>
+											{{item.end_time_text}}继续得{{item.month_repertory}}次
+										</div>
+										<div>
+											{{item.card_end_time_text}}到期
+										</div>
+									</div>
+								</div>
 							</div>
 						</template>
 						<template slot-scope="{ row }" slot="serveInfo">
@@ -450,18 +474,33 @@
 					if (res.status === 200) {
 						let data = res.data;
 						if (this.userFrom.type == 'service_card') {
+							const dataType ='yyyy-MM-dd hh:mm:ss';
 							this.userLists = data.list.map((res) => {
 								if (res.order) {
 									const date = new Date(res.order.add_time * 1000);
-									res.add_time = this.formatDate(date, 'yyyy-MM-dd hh:mm:ss');
+									res.add_time = this.formatDate(date, dataType);
+								}
+								if (res.card) {
+									const card = res.card;
+									if (card.product && card.type == 2) {
+										// 设定时间显示默认样式
+										const card_end_time = new Date(card.card_end_time * 1000);
+										const card_start_time = new Date(card.card_start_time * 1000);
+										const end_time = new Date(card.end_time * 1000);
+										const start_time = new Date(card.start_time * 1000);
+										card.card_end_time_text = that.formatDate(card_end_time, dataType);
+										card.card_start_time_text = that.formatDate(card_start_time, dataType);
+										card.end_time_text = that.formatDate(end_time, dataType);
+										card.start_time_text = that.formatDate(start_time, dataType);
+									}
 								}
 								return res
 							});
 						} else if (this.userFrom.type == 'service_card_record') {
-							console.log(data,'data');
+							console.log(data, 'data');
 							this.userLists = data.list.map((res) => {
 								const date = new Date(res.add_time * 1000);
-								res.add_time = this.formatDate(date, 'yyyy-MM-dd hh:mm:ss');
+								res.add_time = this.formatDate(date, dataType);
 								return res
 							});
 							console.log(this.userLists, 'this.userLists ')
@@ -590,8 +629,7 @@
 								]
 								break;
 							case 'service_card_record':
-								this.columns = [
-									{
+								this.columns = [{
 										title: '服务订单号',
 										key: 'link_id',
 										minWidth: 200
@@ -788,6 +826,11 @@
 </script>
 
 <style lang="less" scoped>
+	.flex{
+		display: flex;
+		justify-content: space-between;
+		align-items: center;
+	}
 	/deep/.ivu-modal-body {
 		padding: 0;
 	}