فهرست منبع

客户与供货商

shish 2 سال پیش
والد
کامیت
5dfd9cb243
5فایلهای تغییر یافته به همراه629 افزوده شده و 14 حذف شده
  1. 2 1
      ghs/src/mock/userInfo.js
  2. 9 4
      ghs/src/views/home.vue
  3. 19 9
      ghs/src/views/in/add.vue
  4. 213 0
      ghs/src/views/in/components/detail-draw.vue
  5. 386 0
      ghs/src/views/in/ghs.vue

+ 2 - 1
ghs/src/mock/userInfo.js

@@ -155,7 +155,8 @@ let menu = {
 		{id: '1400',parentId: null,name: '采购',type: 0,icon: 'icondingdanguanli',orderNum: 3,router: '/in/list',viewPath: 'views/in/list.vue',keepAlive: 1},
 		{id: '1405',parentId: 1400,name: '采购记录',type: 1,icon: 'icondingdanguanli',orderNum: 3,router: '/in/list',viewPath: 'views/in/list.vue',keepAlive: 1},
 		{id: '1410',parentId: 1400,name: '改价入库',type: 1,icon: 'icondingdanguanli',orderNum: 3,router: '/in/change',viewPath: 'views/in/change.vue',keepAlive: 1},
-		{id: '1415',parentId: 1400,name: '新增采购',type: 1,icon: 'icondingdanguanli',orderNum: 3,router: '/in/add',viewPath: 'views/in/add.vue',keepAlive: 1},
+		{id: '1415',parentId: 1400,name: '供货商',type: 1,icon: 'icondingdanguanli',orderNum: 3,router: '/in/ghs',viewPath: 'views/in/ghs.vue',keepAlive: 1},
+		{id: '1420',parentId: 1400,name: '新增采购',type: 1,icon: 'icondingdanguanli',orderNum: 3,router: '/in/add',viewPath: 'views/in/add.vue',keepAlive: 1},
 		{id: '4',parentId: null,name: '花材',type: 0,icon: 'iconshangpinguanli',orderNum: 4,router: '/item/list',viewPath: 'views/item/list.vue',keepAlive: 1},
 		{id: '405',	parentId: '4',name: '花材列表',type: 1,icon: 'icon-user',orderNum: 4,router: '/item/list',viewPath: 'views/item/list.vue',keepAlive: 1},
 		{id: '401',parentId: '4',name: '花材分类',type: 1,icon: 'icon-user',orderNum: 4,router: '/item-class/list',viewPath: 'views/item-class/list.vue',keepAlive: 1},

+ 9 - 4
ghs/src/views/home.vue

@@ -105,10 +105,15 @@ export default {
 					url: '/in/add'
 				},
 				{
-					name: '客户管理',
+					name: '客户',
 					icon: 'iconkehuguanli',
 					url: '/member/list'
 				},
+				{
+					name: '供货商',
+					icon: 'iconkehuguanli',
+					url: '/in/ghs'
+				},
 				{
 					name: '开单记录',
 					icon: 'icondingdanguanli',
@@ -120,17 +125,17 @@ export default {
 					url: '/in/list'
 				},
 				{
-					name: '花材列表',
+					name: '花材',
 					icon: 'iconshangpinguanli',
 					url: '/item/list'
 				},
 				{
-					name: '员工列表',
+					name: '员工',
 					icon: 'iconkehuguanli',
 					url: '/staff/list'
 				},
 				{
-					name: '门店列表',
+					name: '门店',
 					icon: 'icondingdanguanli',
 					url: '/shop/list'
 				}

+ 19 - 9
ghs/src/views/in/add.vue

@@ -1,8 +1,8 @@
 <template>
-  <div v-if="form.ghsId == 0" style="text-align:center;margin-top:30px;">
-    <span style="font-size:20px;">供货商</span>
-    <el-select @change="selectGhsFn" v-model="selectGhsName" filterable remote reserve-keyword placeholder="搜索供货商,光标插入 Ctrl + C" clearable ref="ghsRef"
-				:remote-method="selectGhsInfo" :loading="loading" style="width:400px;margin-left:20px;" size="big">
+  <div v-if="form.ghsId == 0" style="text-align:center;margin-top:60px;">
+    <span style="font-size:20px;">供货商</span>
+    <el-select @change="selectGhsFn" v-model="selectGhsName" filterable remote reserve-keyword placeholder="输入拼音首字母,光标插入 Ctrl + C" clearable ref="ghsRef"
+				:remote-method="selectGhsInfo" :loading="loading" style="width:300px;margin-left:20px;" size="big">
     				<el-option v-for="item in customInfoList" :key="item.id" :label="`${item.name}`" :value="item"></el-option>
   				</el-select>
   </div>
@@ -394,6 +394,13 @@ export default {
 
   },
   mounted() {
+
+    if (this.$route.query.ghsId && this.$route.query.ghsName) {
+      let id = this.$route.query.ghsId
+      let name = this.$route.query.ghsName
+      this.beginSelect(id,name)
+    }
+
     if(this.form.ghsId == 0){
       this.$nextTick(() => {
         this.$refs.ghsRef.focus()
@@ -561,19 +568,22 @@ export default {
     },
     selectGhsFn(e){
       if(e.id && e.name){
+        this.beginSelect(e.id,e.name)
+      }
+		},
+    beginSelect(id,name){
         let that = this
         that.TT = setTimeout(function(){
           that.desk = 'selectedList'
         },2300)
-        this.form.ghsId = e.id
-        this.form.ghsName = e.name
-        this.selectJobId = e.id
+        this.form.ghsId = id
+        this.form.ghsName = name
+        this.selectJobId = id
         this.getFromStorage(false)
         this.$nextTick(()=>{
           this.$refs['itemSearchRef'].focus()
         })
-      }
-		},
+    },
 		selectGhsInfo(query) {
 			let that = this
 			if (query !== '') {

+ 213 - 0
ghs/src/views/in/components/detail-draw.vue

@@ -0,0 +1,213 @@
+<template>
+	<el-drawer
+		title="客户详情"
+		:visible.sync="showStatus"
+		size="70%"
+		:before-close="closeFn"
+		custom-class="member-draw-wrap"
+	>
+		<div class="head-wrap">
+			<div class="head-left">
+				<cl-avatar :size="60" :src="info.avatar" :style="{ margin: 'auto' }"></cl-avatar>
+				<div>{{ info.userName }}</div>
+				<div v-if="info.userAsset">{{ info.userAsset.growth }}</div>
+			</div>
+			<div class="head-right">
+				<div>
+					<div class="info-label">用户ID</div>
+					<div class="info-val">{{ info.id}}</div>
+				</div>
+				<div>
+					<div class="info-label">手机号</div>
+					<div class="info-val">{{ info.mobile || '-' }}</div>
+				</div>
+				<div>
+					<div class="info-label">昵称</div>
+					<div class="info-val">{{ info.userName}}</div>
+				</div>
+				<div>
+					<div class="info-label">粉丝</div>
+					<div class="info-val">{{ info.subscribe == 0 ? '否' : '是' }}</div>
+				</div>
+				<div>
+					<div class="info-label">性别</div>
+					<div class="info-val">
+						<template v-if="info.sex == 1">男</template>
+						<template v-else-if="info.sex == 2">女</template>
+						<template v-else>-</template>
+					</div>
+				</div>
+				<div>
+					<div class="info-label">最近访问</div>
+					<div class="info-val">{{ info.visitTimeFormat}}</div>
+				</div>
+				<div>
+					<div class="info-label">生日</div>
+					<div class="info-val">
+						<template v-if="info.birthday == '0000-00-00'">-</template>
+						<template v-else>{{info.birthday}}</template>
+					</div>
+				</div>
+				<div>
+					<div class="info-label">创建时间</div>
+					<div class="info-val">{{ info.createTime}}</div>
+				</div>
+				<div>
+					<div class="info-label">住址</div>
+					<div class="info-val">{{ info.address || '-' }}</div>
+				</div>
+				<div>
+					<div class="info-label">用户来源</div>
+					<div class="info-val">
+						<template v-if="info.sourceType == 0">微信</template>
+						<template v-else-if="info.sourceType == 1">支付宝</template>
+						<template v-else-if="info.sourceType == 2">小程序</template>
+						<template v-else-if="info.sourceType == 3">朋友圈</template>
+						<template v-else-if="info.sourceType == 4">美团</template>
+						<template v-else-if="info.sourceType == 5">系统</template>
+						<template v-else>-</template>
+					</div>
+				</div>
+			</div>
+		</div>
+		<!-- assets -->
+		<div class="card-wrap">
+			<div class="card-tit">资产信息</div>
+			<el-table :data="assetsData">
+				<el-table-column property="totalExpend" label="消费金额"></el-table-column>
+				<el-table-column property="totalBuyNum" label="消费次数"></el-table-column>
+				<el-table-column property="balance" label="余额"></el-table-column>
+				<el-table-column property="growth" label="成长值"></el-table-column>
+				<el-table-column property="getCouponNum" label="领优惠券数"></el-table-column>
+				<el-table-column property="totalRecharge" label="累计充值"></el-table-column>
+				<el-table-column property="inviteNum" label="邀请新人数"></el-table-column>
+				<el-table-column property="discount" label="享折扣"></el-table-column>
+			</el-table>
+		</div>
+		<!-- order -->
+		<div class="card-wrap">
+			<div class="card-tit">订单记录</div>
+			<el-table :data="orderData">
+				<el-table-column property="id" label="ID"></el-table-column>
+				<el-table-column property="createTime" label="提交时间"></el-table-column>
+				<el-table-column property="actPrice" label="订单金额"></el-table-column>
+				<el-table-column property="payWay" label="支付方式"></el-table-column>
+				<el-table-column property="sendNum" label="编号"></el-table-column>
+				<el-table-column property="status" label="订单状态">
+					<template slot-scope="scope">
+						<span>{{ scope.row.status | constantfilter('ORDER_STATUS') }}</span>
+					</template>
+				</el-table-column>
+				<el-table-column property="discount" label="操作">
+					<template slot-scope="scope">
+						<el-button type="text" size="small" @click="$router.push('/order/list')">查看订单</el-button>
+					</template>
+				</el-table-column>
+			</el-table>
+		</div>
+	</el-drawer>
+</template>
+
+<script>
+export default {
+	name: 'detail-draw',
+	props: {
+		show: {
+			type: Boolean,
+			default: false
+		},
+		info: {
+			type: Object,
+			default: () => {}
+		}
+	},
+	data() {
+		return {
+			showStatus: false,
+			data: {},
+			assetsData: [],
+			orderData: []
+		};
+	},
+	watch: {
+		show(val) {
+			this.showStatus = val;
+			if (val) {
+				this.init();
+			}
+		}
+	},
+	methods: {
+		init() {
+			this.$service.member.allDetail({ userId: this.info.id }).then(res => {
+				this.data = res;
+				this.assetsData = [res.userAsset];
+				this.orderData = res.orderList;
+			});
+		},
+		closeFn(done) {
+			this.$emit('update:show', false);
+			done();
+		}
+	}
+};
+</script>
+
+<style lang="scss">
+.member-draw-wrap {
+	.el-drawer__header {
+		margin-bottom: 20px;
+	}
+}
+</style>
+<style lang="scss" scoped>
+.head-wrap {
+	@include disFlex(center, flex-start);
+	border-top: 1px solid $borderColor;
+	border-bottom: 1px solid $borderColor;
+	padding: 0 10px;
+	.head-left {
+		width: 30%;
+		text-align: center;
+		& > div {
+			margin-top: 20px;
+		}
+	}
+	.head-right {
+		width: calc(100% - 30%);
+		@include disFlex(center, space-between);
+		flex-wrap: wrap;
+		border-left: 1px solid $borderColor;
+		font-size: 14px;
+		& > div {
+			width: 49%;
+			padding: 10px 0;
+			@include disFlex(center, space-between);
+			// border-top: 1px solid $borderColor;
+			&:nth-child(even) {
+				// border-left: 1px solid $borderColor;
+			}
+			.info-label {
+				width: 100px;
+				text-align: right;
+				color: $fontColor3;
+			}
+			.info-val {
+				width: calc(100% - 120px);
+				margin-left: 20px;
+				text-align: left;
+			}
+		}
+	}
+}
+.card-wrap {
+	// padding: 0 20px;
+	margin: 20px;
+	// border: 1px solid $borderColor;
+	// border-bottom: 0;
+	.card-tit {
+		font-size: 16px;
+		margin-bottom: 4px;
+	}
+}
+</style>

+ 386 - 0
ghs/src/views/in/ghs.vue

@@ -0,0 +1,386 @@
+<template>
+	<div class="app-list-content">
+		<x-crud class="liu-crud-wrap" @load="onLoad">
+			<template #slot-tabs>
+				<el-tabs class="liu-tabs" type="border-card" v-model="tabIndex" @tab-click="handleClick">
+					<el-tab-pane
+						v-for="(item, index) in tabsData"
+						:key="index"
+						:label="`${item.text}`"
+						:name="item.key"
+					></el-tab-pane>
+				</el-tabs>
+			</template>
+
+			<template #table-column-avatar="{scope}">
+				<cl-avatar :size="22" :src="scope.row.avatar" :style="{ margin: 'auto' }"></cl-avatar>
+			</template>
+
+			<template #table-column-id="{scope}">
+				<el-link
+					:underline="true"
+					@click="detailShowFn(scope.row)"
+					style="font-size:12px;"
+				>{{ scope.row.id }}</el-link>
+			</template>
+
+			<template #table-column-mobile="{scope}">
+				<span v-if="scope.row.mobile != ''">{{ scope.row.mobile }}</span>
+				<span v-else>-</span>
+			</template>
+
+			<template #table-header-debtAmount>
+				<div class="set-sort">
+				<span style="color:blue;">待结欠款</span>
+				</div>
+			</template>
+			<template #table-column-debtAmount="{scope}">
+				<span v-if="scope.row.debtAmount > 0" style="color:blue;">{{ scope.row.debtAmount?parseFloat(scope.row.debtAmount):0 }}</span>
+				<span v-else>0</span>
+			</template>
+
+			<template #table-column-balance="{scope}">
+				<span>{{ scope.row.balance }}</span>
+			</template>
+
+			<template #table-column-debt="{scope}">
+				<i class="el-icon-success" v-if="scope.row.debt == 1" style="color:green;font-size:18px;cursor: pointer;" @click="modifyDebt(scope.row,0)"></i>
+				<i class="el-icon-open" v-else style="font-size:16px;cursor: pointer;" @click="modifyDebt(scope.row,1)"></i>
+			</template>
+
+			<template #table-column-debtLimit="{scope}">
+				<span v-if="scope.row.debt == 1" style="font-weight:bold;color:green;cursor: pointer;" @click="changeDebtAmount(scope.row)">
+					{{ scope.row.debtLimit ? parseFloat(scope.row.debtLimit) : 0 }}
+				</span>
+				<span v-else>
+					<i class="el-icon-edit" style="font-size:15px;cursor: pointer;" @click="pleaseOpen()"></i>
+				</span>
+			</template>
+
+			<template #table-column-buyAmount="{scope}">
+				<span>{{ scope.row.buyAmount ? parseFloat(scope.row.buyAmount) : 0 }}</span>
+			</template>
+			
+			<template #slot-billing>
+				<el-button type="primary" size="mini" style="margin-left:60px;" @click="add()">添加供货商</el-button>
+				<el-button type="primary" size="mini" style="margin-left:60px;" @click="billing()">开单</el-button>
+				<el-button type="primary" size="mini" style="margin-left:60px;" @click="newCg()">新增采购</el-button>
+			</template>
+
+			<template #table-column-name="{scope}">
+				<el-link
+					:underline="true"
+					@click="detailShowFn(scope.row)"
+					style="font-size:12px;"
+				>{{ scope.row.name }}</el-link>
+			</template>
+
+			<template #slot-column-option="{scope}">
+				<el-button size="small" type="primary" @click="goClear">去清账</el-button>
+				<el-button size="small" type="primary" @click="goCg(scope.row)">去采购</el-button>
+				<el-button size="small" type="primary" @click="modify(scope.row)">修改</el-button>
+				<el-button size="small" type="success" @click="">结账记录</el-button>
+				<el-button size="small" type="success" @click="">采购记录</el-button>
+				<el-button size="small" type="success" @click="">欠款变动明细</el-button>
+			</template>
+
+		</x-crud>
+
+		<!-- 详情 -->
+		<detail-draw :show.sync="drapShow" :info="modalData" />
+
+		<el-dialog :title="rechargeTitle" :visible.sync="rechargePop" width="600px" center :close-on-click-modal="false">
+			<div>
+				<div class="accounts-list">
+					充值金额
+					<el-input style="width: 80%" v-model="rechargeAmount" clearable></el-input>
+				</div>
+				<div class="accounts-list">
+					转账方式
+					<div class="accounts-center">
+						<el-button :type="rechargePayWay == 0?'primary':''" @click="rechargePayWay=0" size="small">微信</el-button>
+						<el-button :type="rechargePayWay == 1?'primary':''" @click="rechargePayWay=1" size="small">支付宝</el-button>
+						<el-button :type="rechargePayWay == 4?'primary':''" @click="rechargePayWay=4" size="small">现金</el-button>
+						<el-button :type="rechargePayWay == 5?'primary':''" @click="rechargePayWay=5" size="small">银行卡</el-button>
+					</div>
+				</div>
+
+				<div class="accounts-list" style="margin-top:20px;">
+					<span></span>
+					<div class="accounts-center">
+						<el-button @click="resetRecharge()">取消</el-button>
+						<el-button type="primary" @click="confirmRecharge()" style="margin-left:80px;">确认</el-button>
+					</div>
+				</div>
+			</div>
+    	</el-dialog>
+
+		<el-dialog title="添加供货商" :visible.sync="addPop" width="600px" center :close-on-click-modal="false">
+			<div>
+				<div class="accounts-list">
+					供货商名称
+					<el-input style="width: 80%" v-model="name1" clearable></el-input>
+				</div>
+				<div class="accounts-list" style="margin-top:20px;">
+					<span></span>
+					<div class="accounts-center">
+						<el-button @click="resetAdd()">取消</el-button>
+						<el-button type="primary" @click="confirmAdd()" style="margin-left:80px;">确认</el-button>
+					</div>
+				</div>
+			</div>
+    	</el-dialog>
+
+	</div>
+</template>
+
+<script>
+import { mapGetters, mapActions } from 'vuex';
+import cardName from './components/card-name';
+import detailDraw from './components/detail-draw';
+export default {
+	components: {
+		cardName,
+		detailDraw
+	},
+	data() {
+		return {
+			app: null,
+			tabIndex: '0',
+			tabsData: [
+				{
+					text: '全部列表',
+					key: '0',
+					val: 0
+				},
+				{
+					text: '欠款排行',
+					key: '2',
+					val: 0
+				}
+			],
+			modalData: {},
+			drapShow: false,
+			rechargeAmount:'',
+			rechargePayWay:-1,
+			rechargePop:false,
+			rechargeTitle:'充值',
+			rechargeCustom:{},
+			name1:'',
+			mobile1:'',
+			confirmMobile1:'',
+			addPop:false
+		};
+	},
+	computed: {
+		...mapGetters({ levelData: 'level' })
+	},
+	created() {
+		this.getLevel();
+	},
+	mounted() {
+		let that = this;
+		document.onkeydown=function(e) {
+			if(e && e.key == ',' && e.ctrlKey){
+				let query = {}
+				that.$router.push({path:'/order/add',query})
+			}
+			if(e && e.key == '.' && e.ctrlKey){
+				let query = {}
+				that.$router.push({path:'/in/add',query})
+			}
+		}
+	},
+	methods: {
+		...mapActions(['getLevel']),
+		goClear(){
+			this.$message({message: '开发中',type: 'warning'})
+		},
+		modify(){
+			this.$message({message: '开发中',type: 'warning'})
+		},
+		newCg(){
+			let query = {}
+			this.$router.push({path:'/in/add',query})
+		},
+		add(){
+			this.addPop = true
+		},
+		resetAdd(){
+			this.name1 = ''
+			this.mobile1 = ''
+			this.addPop = false
+			this.confirmMobile1 = ''
+		},
+		confirmAdd(){
+			if(this.mobile1 != this.confirmMobile1){
+				this.$message({message: '二次手机号不一致',type: 'warning'})
+				return false
+			}
+			if(this.mobile1.length != 11){
+				this.$message({message: '手机号错误',type: 'warning'})
+				return false
+			}
+			if(this.$util.isEmpty(this.name1)){
+				this.$message({message: '请填写名称',type: 'warning'})
+				return false
+			}
+
+			this.$confirm('确认添加?', '提示', { confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning' }).then(() => {
+				this.$service.custom.createCustomers({ name1:this.name1,mobile1:this.mobile1,confirmMobile1:this.confirmMobile1}).then(data => {
+					this.resetAdd()
+					this.$notify({ title: '添加成功,15秒后生效', message: 'success', type: 'success'})
+					this.app.refresh({ type: this.tabIndex })
+				})
+			})
+		},
+		billing(){
+			let query = {}
+			this.$router.push({path:'/order/add',query})
+		},
+		goCg(info){
+			let query = {}
+			query.ghsId = info.id
+			query.ghsName = info.name
+			this.$router.push({path:'/in/add',query})
+		},
+		handleClick(tab, e) {
+			this.app.refresh({ type: this.tabIndex });
+		},
+		detailShowFn(item) {
+			this.modalData = item;
+			this.drapShow = true;
+		},
+		onLoad({ ctx, app }) {
+			this.app = app;
+
+			//传入参数 shish 2020.5.9
+			if (this.$route.query.type) {
+				this.tabIndex = this.$route.query.type;
+			}
+
+			ctx.service(this.$service.ghs)
+				.set('table', {
+					columns: [
+						{
+							prop: 'id',
+							label: 'ID',
+							align: 'center',
+							width: 100
+						},
+						{
+							prop: 'avatar',
+							label: '头像',
+							align: 'center',
+							width: 100
+						},
+						{
+							prop: 'name',
+							label: '名称',
+							align: 'center',
+							width: 300
+						},
+						{
+							prop: 'debtAmount',
+							label: '欠款',
+							align: 'center',
+							width: 100
+						},
+						{
+							prop: 'debtNum',
+							label: '欠款笔数',
+							align: 'center',
+							width: 90
+						},
+						{
+							prop: 'updateTime',
+							label: '最近访问',
+							align: 'center',
+							width: 160
+						},
+						{
+							prop: 'addTime',
+							label: '添加时间',
+							align: 'center',
+							width: 160
+						}
+					],
+					op: {
+						visible: true,
+						props: {
+							width: 550,
+							align: 'center',
+							fixed: 'right',
+							label: '操作'
+						},
+						layout: ['slot-column-option']
+					}
+				})
+				.set('dict', {
+					search: {
+						keyWord: 'name'
+					}
+				})
+				.set('search', {
+					key: { placeholder: '这里搜索' }
+				})
+				.set('layout', [
+					['slot-tabs'],
+					['search-key','slot-billing'],
+					['data-table'],
+					['flex1', 'pagination']
+				])
+				.on('refresh', async (params, { next }) => {
+					let result = await next(params);
+					this.tabsData[0].val = result.totalUser
+					this.tabsData[1].val = result.mayGatheringNum
+				})
+				.done();
+			app.refresh({ type: this.tabIndex });
+		}
+	}
+};
+</script>
+
+<style lang="scss" scoped>
+.user-name-warp {
+	display: flex;
+	align-items: center;
+	span {
+		margin-left: 6px;
+	}
+}
+.recharge-modal-content {
+	@include disFlex(center, space-around);
+	.card-name {
+		width: 200px;
+		height: 100%;
+		border-right: 1px solid $borderColor;
+	}
+}
+
+.store-icon {
+	i {
+		font-size: 18px;
+	}
+
+	.el-icon-check {
+		color: #fee470;
+	}
+
+	.el-icon-close {
+		color: #999;
+	}
+}
+.accounts-list{
+    width: 80%;
+    display: flex;
+    align-items: center;
+    justify-content: space-between;
+    margin: 0 auto;
+    padding-bottom: 20px;
+    .accounts-center{
+      width: 80%;
+    }
+  }
+</style>