Ver Fonte

2024-2-19

cmy há 1 ano atrás
pai
commit
17626f5030

+ 3 - 3
src/api/order.js

@@ -693,11 +693,11 @@ export function active_refund_order(data) {
 	    data});
 }
 //员工订单统计
-export function getSubscribeOrderCount(data) {
+export function getSubscribeOrderCount(params) {
 	return request({
 	    url: `/work/getSubscribeOrderCount`,
-	    method: 'post',
-	    data
+	    method: 'get',
+	    params
 		});
 }
 

+ 1 - 1
src/pages/agent/kpi/index.vue

@@ -32,7 +32,7 @@
 			</div>
 		</Card>
 		<cards-data :cardLists="cardLists"></cards-data>
-		<Card :bordered="false" dis-hover class="ivu-mt">
+		<Card :bordered="false" dis-hover>
 			<!-- 售后订单表格 -->
 			<Table :columns="thead" :data="tbody" ref="table" :loading="loading" highlight-row no-userFrom-text="暂无数据"
 				no-filtered-userFrom-text="暂无筛选结果">

+ 151 - 265
src/pages/marketing/serve/bind.vue

@@ -9,65 +9,68 @@
 							<span class="pl10">返回</span>
 						</div>
 					</router-link>
-					<span v-text="$route.params.id ? '编辑服务卡' : '添加服务卡'" class="mr20 ml16"></span>
+					<span v-text="'绑定项目'" class="mr20 ml16"></span>
 				</div>
 			</PageHeader>
 		</div>
-		<Card :bordered="false" dis-hover class="ivu-mt"  >
-			<div v-for="(item,index) in formData" class="product-item">
-				<Button type="primary" class="submission" @click="delNewProject(index,item)" >删除</Button>
-				<Form   :model="item" :label-width="150" >
-					<FormItem label="选择服务项目:" prop="product_id" required>
-					    <div class="picBox" @click="changeGoods(item)">
-							<Button type="primary" v-if="!item.product_id">选择服务项目</Button>
-							<template v-else>
-								<viewer>
-									<img class="product_img" :src="item.slider_image" alt="" />
-								</viewer>
-								<div class="">
-									{{item.store_name}}
-								</div>
-								<div class="">
-									商品原价: {{ showPrice(item.product_id).price }} 元
-								</div>
-								<div class="">
-									商品ID:{{item.product_id}}
-								</div>
-								<Button type="primary" >切换服务项目</Button>
-							</template>
-					    </div>
-						<div></div>
-					</FormItem>
-					<!-- <FormItem label="业绩值" required>
-						<Input  v-model="item.performance_value" v-width="320"></Input>
-					</FormItem>
-					<FormItem label="手工费" required>
-						<Input  v-model="item.craft_price" v-width="320"></Input>
-					</FormItem>
-					<FormItem label="销售提成" required>
-						<Input  v-model="item.sales_commissions" v-width="320"></Input>
-					</FormItem> -->
-					<FormItem label="次数" required>
-						<InputNumber  v-model="item.repertory" v-width="320"></InputNumber>
-					</FormItem>
-				</Form>
-				<!-- <div class="" v-if="item.repertory">
-					合计:业绩值:{{item.performance_value * item.repertory || 0 }} 手工费:{{item.craft_price *item.repertory || 0}} 销售提成:{{item.sales_commissions * item.repertory || 0}}
-				</div> -->
+		<Card :bordered="false" dis-hover class="ivu-mt">
+			<div class="flex-box">
+				<div v-for="(item,index) in formData" class="product-item">
+					<Form :model="item" :label-width="100">
+						<FormItem label="服务项目" prop="product_id" required>
+							<div class="picBox" >
+								<Button type="primary" @click="changeGoods(item)" v-if="!item.product_id">选择服务项目</Button>
+								<template v-else>
+									<viewer>
+										<img class="product_img" :src="item.slider_image" alt="" />
+									</viewer>
+									<div class="">
+										{{item.store_name}}
+									</div>
+									<div class="">
+										商品原价: {{ item.craft_price }} 元
+									</div>
+									<div class="">
+										商品ID:{{item.product_id}}
+									</div>
+									<Button type="primary" @click="changeGoods(item)">切换服务项目</Button>
+								</template>
+							</div>
+							<div></div>
+						</FormItem>
+						<FormItem label="服务类型" required>
+							<Select v-model="item.type" placeholder="请选择" clearable v-width="320">
+								<Option :value="1">一次性</Option>
+								<Option :value="2">每月发放</Option>
+							</Select>
+						</FormItem>
+						<FormItem label="发放月数" required v-if="item.type==2">
+							<Input v-model="item.month" v-width="320" placeholder=""></Input>
+						</FormItem>
+						<FormItem label="每月张数" required v-if="item.type==2">
+							<InputNumber v-model="item.num" v-width="320"></InputNumber>
+						</FormItem>
+						<FormItem label="总次数" required v-if="item.type==2">
+							{{item.month*item.num}}
+						</FormItem>
+						<FormItem label="服务次数" required v-if="item.type==1">
+							<InputNumber v-model="item.repertory" v-width="320"></InputNumber>
+						</FormItem>
+					</Form>
+					<Button type="error" long @click="delNewProject(index,item)">删除</Button>
+				</div>
 			</div>
-			<!-- <div class="heji">
-				总计:业绩值:{{ showAll('performance_value',formData)|| 0}} 手工费:{{showAll('craft_price',formData)|| 0}} 销售提成:{{showAll('sales_commissions',formData)|| 0}}
-			</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 style="width: 500px; display: flex;justify-content: center;">
-			<Button  type="primary bom" class="submission" @click="addNewProject" >添加新项目</Button>
-			<Button  type="primary" class="submission" @click="save" :disabled="disabled">保存</Button>
+		<div class="footer-buttom">
+			<Button type="primary" class="submission mr20" @click="addNewProject">添加新项目</Button>
+			<Button type="primary" class="submission" @click="save" :disabled="disabled">保存</Button>
 		</div>
 	</div>
 </template>
@@ -76,227 +79,139 @@
 	import {
 		mapState
 	} from "vuex";
-	import storeList from "@/components/storeList";
 	import goodsList from "@/components/goodsList/index";
 	import {
-		couponCategoryApi,
-		couponSaveApi,
-		couponDetailApi,
-		VipEditApi,
-		serveAddApi,
 		bindServe,
 		addServiceProject,
 		serveReadApi,
 		serveProductDeleteApi
 	} from "@/api/marketing";
-	import {
-		brandList,
-		changeListApi
-	} from "@/api/product";
-	// import { formatDate } from '@/utils/validate';
 	import Setting from "@/setting";
 	export default {
 		name: "storeCouponCreate",
 		components: {
 			goodsList,
-			storeList
 		},
 		data() {
 			return {
-				baseForm: {
-					product_name: '',
-					product_id: 0,
-					performance_value: 0,
-					craft_price: 0,
-					sales_commissions: 0,
-					repertory: 0
-				},//基础数据
-				modal_loading: false,
-				 modals: false,
-				id: '',
 				roterPre: Setting.roterPre,
 				disabled: false,
-				storesList: [],
-				formData: [{
-					id: 0,
-					service_card_id: 0,
-					product_id: 0,
-					store_name: '',
-					slider_image: '',
-					performance_value: '',
-					craft_price: '',
-					sales_commissions: '',
-					repertory: 0,
-				}],
-				isMinPrice: 0,
-				isCouponTime: 1,
-				isReceiveTime: 0,
+				formData: [],
 				modals: false,
-				datetime1: [],
-				datetime2: [],
-				storeModals: false,
-				currentTab: '1',
 				current: {},
 				service_card_id: '',
-				productList: [],
 			};
 		},
-		computed: {
-			...mapState("admin/layout", ["isMobile", "menuCollapse"]),
-		},
 		created() {
-			this.getProductList()
-			console.log(this.$route.query);
 			if (this.$route.query.id) {
 				this.service_card_id = this.$route.query.id
-				this.formData[0].service_card_id = this.$route.query.id
 				this.getCouponDetail();
+			} else {
+				this.addNewProject()
 			}
 		},
 		methods: {
-			showPrice(id) {
-				let item = this.productList.find(i=> {
-					return i.id == id
-				})
-				if(item) {
-					return item
-				}else {
-					return ''
-				}
-			},
-			getProductList() {
-				changeListApi({
-					service_project: 1,
-					page: 1,
-					limit:1000
-				}).then(res => {
-					this.productList = res.data.list
-				})
-			},
-			showAll(name,list) {
-				let num = 0;
-				list.forEach(item => {
-					if(item.repertory) {
-						num += item[name] * item.repertory * 1;
-					}
-				})
-				return num;
-			},
 			getCouponDetail() {
 				let that = this
 				serveReadApi(that.service_card_id).then(res => {
-					that.formData = res.data.info.storeInfo.project
-					if(that.formData.length == 0) {
-						that.formData = [{
-							id: 0,
-							service_card_id: that.service_card_id,
-							product_id: 0,
-							store_name: '',
-							slider_image: '',
-							performance_value: '',
-							craft_price: '',
-							sales_commissions: '',
-							repertory: 0,
-						}]
+					if (res.data.info.storeInfo.project.length>0) {
+						that.formData = res.data.info.storeInfo.project.map(
+							(rs) => {
+								if (rs.type == 2) {
+									rs.num = Math.floor(rs.repertory / rs.month);
+								}
+								return rs
+							}
+						)
+					} else {
+						that.addNewProject();
 					}
 				})
 			},
 			// 选择商品
 			changeGoods(item) {
-			    this.modals = true;
-				this.current = item
+				this.modals = true;
+				this.current = item;
+				console.log(item, 'item');
 			},
 			addNewProject() {
-				console.log('dddddddddddddddddd');
 				let that = this
-				try{
+				try {
 					this.formData.push({
-					service_card_id: that.service_card_id,
-					id: 0,
-					product_id: 0,
-					store_name: '',
-					slider_image: '',
-					performance_value: '',
-					craft_price: '',
-					sales_commissions: '',
-					repertory: 0,
-				})
+						service_card_id: that.service_card_id,
+						id: 0,
+						product_id: 0,
+						store_name: '',
+						slider_image: '',
+						performance_value: '',
+						craft_price: '',
+						sales_commissions: '',
+						repertory: 0,
+						type: 1,
+						month: 0,
+						num: 1,
+					})
 					// this.formData.concat(this.baseForm)
 					console.log(this.formData);
-				}catch(e){
+				} catch (e) {
 					console.log(e);
 					//TODO handle the exception
 				}
 			},
-			delNewProject(index,item) {
+			delNewProject(index, item) {
 				let that = this
-				if(item.id) {
-					try{
+				if (item.id) {
+					try {
 						let delfromData = {
-						    title: '删除服务项目',
-						    url: `service/productDelete/${item.id}`,
-						    method: 'DELETE',
-						    ids: ''
+							title: '删除服务项目',
+							url: `service/productDelete/${item.id}`,
+							method: 'DELETE',
+							ids: ''
 						};
 						this.$modalSure(delfromData).then((res) => {
-						    that.$Message.success(res.msg);
-						   that.formData.splice(index,1)
+							that.$Message.success(res.msg);
+							that.formData.splice(index, 1)
 						}).catch(res => {
-						    that.$Message.error(res.msg);
+							that.$Message.error(res.msg);
 						});
-					}catch(e){
+					} catch (e) {
 						//TODO handle the exception
-						console.log(e,'错误');
+						console.log(e, '错误');
 					}
-					
 					// serveProductDeleteApi(item.id).then(res => {
 					// 	this.formData.splice(index,1)
 					// })
-				}else {
-					this.formData.splice(index,1)
+				} else {
+					that.formData.splice(index, 1)
 				}
-				if(that.formData.length == 0) {
-					that.formData = [{
-						id: 0,
-						service_card_id: that.service_card_id,
-						product_id: 0,
-						store_name: '',
-						slider_image: '',
-						performance_value: '',
-						craft_price: '',
-						sales_commissions: '',
-						repertory: 0,
-					}]
+				if (that.formData.length == 0) {
+					that.addNewProject();
 				}
 			},
 			// 商品id
 			getProductId(row) {
-				console.log(row,'这个');
-			    this.modal_loading = false;
-			    this.modals = false;
-			    setTimeout(() => {
+				console.log(row, '这个');
+				this.modals = false;
+				setTimeout(() => {
 					this.current.product_id = row.id
 					this.current.store_name = row.store_name
 					this.current.slider_image = row.image
-					// this.formData.image = row.image
-			    }, 500);
-			},
-			downTab() {
-				if (!this.formData.card_name) {
-					return this.$Message.error("请输入服务卡名称");
-				}
-				if (!this.formData.card_price) {
-					return this.$Message.error("请输入售价");
-				}
-				if (!this.formData.repertory) {
-					return this.$Message.error("请输入库存");
-				}
+					this.current.craft_price = row.price
+				}, 500);
 			},
 			// 创建
 			save() {
-				// this.downTab();
-				// console.log('这');
-				bindServe(this.service_card_id,{item: this.formData})
+				for (let i = 0; i < this.formData.length; i++) {
+					const item = this.formData[i];
+					if (item.type == 2) {
+						item.repertory = Math.floor(item.month * item.num);
+					}
+				}
+
+
+				bindServe(this.service_card_id, {
+						item: this.formData
+					})
 					.then((res) => {
 						this.disabled = true;
 						this.$Message.success(res.msg);
@@ -311,68 +226,30 @@
 						this.disabled = false;
 					});
 			},
-			// 使用有效期--时间段
-			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)
-				);
-			},
-			// // 选择的商品
-			// getProductId(productList) {
-			// 	this.modals = false;
-			// 	this.productList = this.unique(this.productList.concat(productList));
-			// 	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}`;
-			// 		}
-			// 	});
-			// },
 			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}`;
-					}
-				});
-			},
-			cancel() {
-			    this.modals = false;
-			},
-			
+
 		},
 	};
 </script>
 
 <style scoped lang="stylus">
-	.product_img{
-		width:100px;
-		height:100px;
+	.product_img {
+		width: 100px;
+		height: 100px;
+	}
+
+	.footer-buttom {
+		padding: 20px 0;
+	}
+
+	.flex-box {
+		display: flex;
+		justify-content: flex-start;
+		flex-wrap: wrap;
 	}
+
 	.tips {
 		display: inline-bolck;
 		font-size: 12px;
@@ -542,27 +419,36 @@
 	/deep/.vxe-tree-cell {
 		padding-left: 0 !important;
 	}
+
 	.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);
-	    cursor: pointer;
+		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);
+		cursor: pointer;
 	}
+
 	.product-item {
 		border: 1px solid #eee;
-		min-width: 300px;
-		padding: 20px
+		width: 600px;
+		padding: 20px;
+		margin-bottom: 15px;
+		border-radius: 10px;
+		box-shadow: 0px 0px 10px #e3e3e3;
+		margin-right: 20px;
+
 		.submission {
 			// display: block;
 			margin-left: 500px;
 		}
 	}
+
 	.bom {
 		margin-right: 20px
 	}
+
 	.heji {
 		padding: 10px
 	}

+ 4 - 2
src/pages/marketing/serve/create.vue

@@ -9,7 +9,7 @@
 							<span class="pl10">返回</span>
 						</div>
 					</router-link>
-					<span v-text="$route.params.id ? '编辑服务卡' : '添加服务卡'" class="mr20 ml16"></span>
+					<span v-text="$route.query.id ? '编辑服务卡' : '添加服务卡'" class="mr20 ml16"></span>
 				</div>
 			</PageHeader>
 		</div>
@@ -93,7 +93,9 @@
 					unit_name: '',
 					image: '',
 					images: '',
-					discount: 0
+					discount: 0,
+					type:1,
+					month:1,
 				},
 				isMinPrice: 0,
 				isCouponTime: 1,

+ 19 - 13
src/pages/marketing/serve/index.vue

@@ -3,9 +3,16 @@
 		<Card :bordered="false" dis-hover class="mt15 ivu-mt" :padding="0">
 			<div class="new_card_pd">
 				<!-- 查询条件 -->
-				
 				<Form ref="tableFrom" inline :model="tableFrom" :label-width="labelWidth"
 					:label-position="labelPosition" @submit.native.prevent>
+					<FormItem label="类型:" label-for="is_show">
+						<Select v-model="tableFrom.is_del" placeholder="请选择" clearable @on-change="userSearchs"
+							class="input-add">
+							<Option :value="0">全部</Option>
+							<Option :value="1">普通卡</Option>
+							<Option :value="2">月卡</Option>
+						</Select>
+					</FormItem>
 					<FormItem label="是否删除:" label-for="is_show">
 						<Select v-model="tableFrom.is_del" placeholder="请选择" clearable @on-change="userSearchs"
 							class="input-add">
@@ -13,17 +20,14 @@
 							<Option :value="1">已删除</Option>
 						</Select>
 					</FormItem>
-					<FormItem label="服务卡名称:" label-for="coupon_title">
-						<Input v-model="tableFrom.key" placeholder="请输入服务卡名称名称" @on-search="userSearchs"
+					<FormItem label="服务卡:" label-for="coupon_title">
+						<Input v-model="tableFrom.key" placeholder="请输入服务卡名称/ID" @on-search="userSearchs"
 							class="input-add mr14" />
 						<Button type="primary" @click="orderSearch()" class="mr14">查询</Button>
 					</FormItem>
 				</Form>
 			</div>
 		</Card>
-		<div class="i-layout-page-header">
-			<PageHeader class="product_tabs" title="服务卡" hidden-breadcrumb></PageHeader>
-		</div>
 		<Card :bordered="false" dis-hover class="ivu-mt">
 			<Form ref="tableFrom" :model="tableFrom" :label-width="labelWidth" :label-position="labelPosition"
 				@submit.native.prevent>
@@ -52,11 +56,13 @@
 					<span> {{row.add_time }}</span>
 				</template>
 				<template slot-scope="{ row, index }" slot="action">
-					<a @click="bind(row)">绑定项目</a>
-					<Divider type="vertical" />
-					<a @click="couponSend(row)">编辑</a>
-					<Divider type="vertical" />
-					<a @click="couponDel(row,'删除服务卡',index)">删除</a>
+					<block v-if="tableFrom.is_del==0">
+						<a @click="bind(row)">绑定项目</a>
+						<Divider type="vertical" />
+						<a @click="couponSend(row)">编辑</a>
+						<Divider type="vertical" />
+						<a @click="couponDel(row,'删除服务卡',index)">删除</a>
+					</block>
 				</template>
 			</Table>
 			<div class="acea-row row-right page">
@@ -141,8 +147,8 @@
 						minWidth: 100
 					},
 					// {
-					// 	title: '备注',
-					// 	key: 'explain',
+					// 	title: '类型',
+					// 	key: 'type',
 					// 	minWidth: 100
 					// },
 					{

+ 72 - 11
src/pages/order/serveuser/index.vue

@@ -6,11 +6,19 @@
 				<!-- 筛选条件 -->
 				<Form ref="pagination" inline :model="pagination" :label-width="labelWidth"
 					:label-position="labelPosition" @submit.native.prevent>
+					
 					<FormItem label="时间范围:">
 						<DatePicker :editable="false" @on-change="onchangeTime" :value="timeVal" format="yyyy/MM/dd"
 							type="daterange" placement="bottom-start" placeholder="自定义时间" class="input-add"
 							:options="options"></DatePicker>
-						<Button type="primary" @click="orderSearch()">查询</Button>
+					</FormItem>
+					<FormItem label="搜索:" label-for="title">
+					  <Input
+					    v-model="pagination.name"
+					    placeholder="请输入手机号/姓名/昵称"
+					    class="input-add mr14"
+					  />
+					  <Button type="primary" @click="orderSearch()">查询</Button>
 					</FormItem>
 				</Form>
 			</div>
@@ -46,10 +54,71 @@
 				loading: false,
 				total: 0,
 				orderId: 0,
+				thead: [{
+						title: "ID",
+						key: "id",
+						width: 80,
+					},
+					{
+						title: "员工昵称",
+						key: "alias",
+						minWidth: 100,
+					},
+					{
+						title: "姓名",
+						key: "name",
+						minWidth: 100,
+					},
+					{
+						title: "手机号",
+						key: "mobile",
+						minWidth: 100,
+					},
+					{
+						title: "职务信息",
+						key: "position",
+						minWidth: 100,
+					}, {
+						title: "销售业绩",
+						key: "sale_sum",
+						minWidth: 100,
+					},
+					{
+						title: "手工业绩",
+						key: "craft_sum",
+						minWidth: 100,
+					},
+					{
+						title: "订单数",
+						key: "count",
+						minWidth: 100,
+					},
+					{
+						title: "总股权",
+						key: "total_shareholding",
+						minWidth: 100,
+					},
+					{
+						title: "现有股权",
+						key: "shareholding",
+						minWidth: 100,
+					},
+					{
+						title: "销售比率",
+						key: "sale_ratio",
+						minWidth: 100,
+					},
+					{
+						title: "手工比率",
+						key: "craft_ratio",
+						minWidth: 100,
+					},
+				],
 				pagination: {
 					page: 1,
 					limit: 15,
-					time: "",
+					add_time: "",
+					name:''
 				},
 				options: timeOptions,
 				timeVal: [],
@@ -57,7 +126,6 @@
 			};
 		},
 		computed: {
-			...mapState("order", ["orderChartType"]),
 			// ...mapState("admin/layout", ["isMobile"]),
 			labelWidth() {
 				return this.isMobile ? undefined : 96;
@@ -74,7 +142,7 @@
 			onchangeTime(e) {
 				this.pagination.page = 1;
 				this.timeVal = e;
-				this.pagination.time = this.timeVal[0] ? this.timeVal.join("-") : "";
+				this.pagination.add_time = this.timeVal[0] ? this.timeVal.join("-") : "";
 			},
 			// 订单列表
 			getOrderList() {
@@ -85,16 +153,9 @@
 						const {
 							count,
 							list,
-							num
 						} = res.data;
 						this.total = count;
 						this.tbody = list;
-						this.num = num;
-						list.forEach((item) => {
-							if (item.id == this.orderId) {
-								this.rowActive = item;
-							}
-						});
 					})
 					.catch((err) => {
 						this.loading = false;