Kaynağa Gözat

合作伙伴角色加入

qzyReal 3 yıl önce
ebeveyn
işleme
5796ca0ec1
47 değiştirilmiş dosya ile 2051 ekleme ve 648 silme
  1. 19 4
      app/apis/api.js
  2. 41 2
      app/pages.json
  3. 240 0
      app/pages/business-item/item-detail.vue
  4. 248 0
      app/pages/business-order/business-item.vue
  5. 6 1
      app/pages/business-order/business-order.vue
  6. 221 0
      app/pages/business-order/partner-business-item.vue
  7. 68 0
      app/pages/home/home.vue
  8. 47 2
      app/pages/index/index.vue
  9. 1 7
      app/pages/login/login.vue
  10. 314 0
      app/pages/partner/index.vue
  11. 2 2
      app/utils/request.js
  12. 12 21
      sp-admin/sa-frame/menu-list.js
  13. 38 14
      sp-admin/sa-view/tb-item/tb-item-list.html
  14. 2 13
      sp-admin/sa-view/tb-partner/customer-admin-add.html
  15. 1 7
      sp-admin/sa-view/tb-partner/customer-admin-list.html
  16. 124 0
      sp-admin/sa-view/tb-partner/tb-business-item-list.html
  17. 0 232
      sp-admin/sa-view/tb-partner/tb-costomer-judge.html
  18. 6 12
      sp-admin/sa-view/tb-partner/tb-partner-info.html
  19. 8 28
      sp-admin/sa-view/tb-partner/tb-partner-list.html
  20. 1 1
      sp-server/app.pid
  21. 53 8
      sp-server/src/main/java/com/pj/api/h5/ApiController.java
  22. 67 0
      sp-server/src/main/java/com/pj/api/service/ApiService.java
  23. 28 0
      sp-server/src/main/java/com/pj/api/wx/bo/BaseTemplate.java
  24. 25 0
      sp-server/src/main/java/com/pj/api/wx/bo/Msg.java
  25. 50 0
      sp-server/src/main/java/com/pj/api/wx/bo/MsgDataBO.java
  26. 21 2
      sp-server/src/main/java/com/pj/api/wx/service/WxService.java
  27. 1 1
      sp-server/src/main/java/com/pj/constants/RoleEnum.java
  28. 24 0
      sp-server/src/main/java/com/pj/current/config/WxConfig.java
  29. 25 10
      sp-server/src/main/java/com/pj/project/tb_business/TbBusinessService.java
  30. 7 0
      sp-server/src/main/java/com/pj/project/tb_business_item/TbBusinessItem.java
  31. 42 33
      sp-server/src/main/java/com/pj/project/tb_business_item/TbBusinessItemController.java
  32. 3 1
      sp-server/src/main/java/com/pj/project/tb_business_item/TbBusinessItemMapper.xml
  33. 3 1
      sp-server/src/main/java/com/pj/project/tb_business_item/TbBusinessItemService.java
  34. 1 1
      sp-server/src/main/java/com/pj/project/tb_costomer/TbCostomer.java
  35. 0 1
      sp-server/src/main/java/com/pj/project/tb_costomer/TbCostomerController.java
  36. 2 0
      sp-server/src/main/java/com/pj/project/tb_costomer/TbCostomerMapper.java
  37. 71 75
      sp-server/src/main/java/com/pj/project/tb_costomer/TbCostomerMapper.xml
  38. 5 0
      sp-server/src/main/java/com/pj/project/tb_costomer/TbCostomerService.java
  39. 4 0
      sp-server/src/main/java/com/pj/project/tb_item_type/TbItemType.java
  40. 2 3
      sp-server/src/main/java/com/pj/project/tb_item_type/TbItemTypeController.java
  41. 3 1
      sp-server/src/main/java/com/pj/project4sp/admin/SpAdmin.java
  42. 10 0
      sp-server/src/main/java/com/pj/project4sp/admin/SpAdminController.java
  43. 6 0
      sp-server/src/main/java/com/pj/project4sp/admin/SpAdminMapper.java
  44. 80 70
      sp-server/src/main/java/com/pj/project4sp/admin/SpAdminMapper.xml
  45. 11 4
      sp-server/src/main/java/com/pj/project4sp/admin/SpAdminService.java
  46. 104 91
      sp-server/src/main/java/com/pj/project4sp/admin4login/SpAccAdminService.java
  47. 4 0
      sp-server/src/main/resources/application-dev.yml

+ 19 - 4
app/apis/api.js

@@ -120,7 +120,7 @@ export default {
 	getBusinessMoney(data) {
 		return ajax.get('/api/getBusinessMoney', data)
 	},
-	
+
 	getWxConfig(data) {
 		return ajax.get('/wx/getWxConfig', data)
 	},
@@ -136,13 +136,28 @@ export default {
 	uploadReport(data) {
 		return ajax.postJson('/TbBusiness/uploadReport', data)
 	},
-	getDeclareList(data){
+	getDeclareList(data) {
 		return ajax.get('/api/getDeclareList', data)
 	},
-	getAccountInfo(){
+	getAccountInfo() {
 		return ajax.get('/api/getAccountInfo')
 	},
-	getDiscountInfo(){
+	getDiscountInfo() {
 		return ajax.get('/api/getDiscountInfo')
+	},
+	getBusinessItem(data) {
+		return ajax.get('/api/getBusinessItem', data)
+	},
+	pickBusinessItem(data) {
+		return ajax.postForm('/api/pickBusinessItem', data)
+	},
+	confirmBusinessItem(data) {
+		return ajax.postForm('/api/confirmBusinessItem', data)
+	},
+	getPartnerBusinessItem(data) {
+		return ajax.get('/api/getPartnerBusinessItem', data)
+	},
+	checkUserType(){
+		return ajax.get('/api/checkUserType')
 	}
 }

+ 41 - 2
app/pages.json

@@ -9,14 +9,24 @@
 				"navigationBarTitleText": "" //首页
 				//"navigationStyle":"custom"
 			}
-		}, {
+		}, 
+		{
 			"path": "pages/enterprise-reg/enterprise-reg",
 			"style": {
 				"navigationBarTitleText": "" //企业注册
 				//"navigationStyle":"custom"
 			}
 
-		}, {
+		},
+		{
+			"path": "pages/home/home",
+			"style": {
+				"navigationBarTitleText": "" //跳转页
+			}
+		
+		}
+		
+		, {
 			"path": "pages/login/login",
 			"style": {
 				"navigationBarTitleText": "" //登录
@@ -218,6 +228,35 @@
 				"navigationStyle": "custom"
 			}
 
+		},
+		{
+			"path": "pages/business-item/item-detail",
+			"style": {
+				"navigationBarTitleText": "",
+				"navigationStyle": "custom"
+			}
+		
+		},
+		{
+			"path": "pages/business-order/business-item",
+			"style": {
+				"navigationBarTitleText": ""
+			}
+		
+		},
+		{
+			"path": "pages/partner/index",
+			"style": {
+				"navigationBarTitleText": ""
+			}
+		
+		},
+		{
+			"path": "pages/business-order/partner-business-item",
+			"style": {
+				"navigationBarTitleText": ""
+			}
+		
 		}
 
 

+ 240 - 0
app/pages/business-item/item-detail.vue

@@ -0,0 +1,240 @@
+<template>
+	<view>
+		<view class="box">
+			<view class="top">
+				<text class="title">业务详情</text>
+			</view>
+		</view>
+		<view class="card-box">
+			<view class="card">
+				<view class="t">
+					<image class="icon" src="../../static/home-icon-01.png"></image>
+					<text class="title">{{businessItem.itemTypeName}}</text>
+				</view>
+				<view class="c">
+					<view class="item car-num-item">
+						<text class="car-num">{{businessItem.itemName}}</text>
+					</view>
+				</view>
+				<view class="c">
+					<view class="item">
+						<text class="p1">录入时间:</text>
+						<text class="p2">{{businessItem.createTime}}</text>
+					</view>
+				</view>
+				<view class="c">
+					<view class="item">
+						<text class="p1">状态:</text>
+						<text class="p2">
+							<text v-if="businessItem.pick==1">已接单</text>
+							<text v-else>未接单</text>
+						</text>
+					</view>
+				</view>
+				<view class="c">
+					<view class="item" v-if="businessItem.pickTime">
+						<text class="p1">接单时间:</text>
+						<text class="p2">
+							<text>{{businessItem.pickTime}}</text>
+						</text>
+					</view>
+				</view>
+				<view class="c" v-if="businessItem.pick==1">
+					<view class="item" >
+						<text class="p1">确认状态:</text>
+						<text class="p2">
+							<text v-if="businessItem.confirm==1">已确认</text>
+							<text v-else>未确认</text>
+						</text>
+					</view>
+				</view>
+				<view class="c" v-if="businessItem.confirm==1">
+					<view class="item" >
+						<text class="p1">确认时间:</text>
+						<text class="p2">
+							<text>{{businessItem.confirmTime}}</text>
+						</text>
+					</view>
+				</view>
+				<view class="b">
+					<view class="btn b3" v-if="businessItem.pick==0" @click="pickFn">
+						接单</view>
+				</view>
+			</view>
+		</view>
+
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				openid: '',
+				businessItem: {}
+			}
+		},
+		onLoad(option) {
+			this.businessItem.id = option.itemId;
+			this.openid = option.openid;
+			this.getBusinessItem();
+		},
+		onBackPress() {
+			this.$common.to('/pages/index/index')
+			return true;
+		},
+		methods: {
+			getBusinessItem() {
+				this.$api.getBusinessItem({
+					id: this.businessItem.id
+				}).then(resp => {
+					this.businessItem = resp.data;
+				})
+			},
+			pickFn() {
+				let that = this;
+				uni.showModal({
+					title: '提示',
+					content: '是否确认接单?',
+					success(resp) {
+						if (resp.confirm) {
+							that.surePick();
+						}
+					}
+				})
+			},
+			surePick() {
+				let obj = {
+					openid: this.openid,
+					id: this.businessItem.id
+				};
+				this.$api.pickBusinessItem(obj).then(resp => {
+					if (resp.code == 200) {
+						this.$common.toast('已接单');
+						this.getBusinessItem();
+					}
+				})
+			}
+		}
+	}
+</script>
+
+<style lang="scss">
+	.card-box {
+		display: flex;
+		width: 100%;
+		flex-direction: column;
+
+		.card {
+			background-color: #fff;
+			border-radius: 20rpx;
+			margin: 20rpx 20rpx 0 20rpx;
+			padding: 30rpx;
+			box-sizing: border-box;
+			display: flex;
+			flex-direction: column;
+
+			.t {
+				width: 100%;
+				display: flex;
+				align-items: center;
+				padding-bottom: 30rpx;
+				border-bottom: 1rpx solid #f5f5f5;
+
+				.icon {
+					width: 40rpx;
+					height: 40rpx;
+				}
+
+				.title {
+					font-size: 35rpx;
+					font-weight: bold;
+					margin-left: 20rpx;
+				}
+			}
+
+			.c {
+				padding: 15rpx 0 30rpx 0;
+				display: flex;
+				flex-wrap: wrap;
+				border-bottom: 1rpx solid #f5f5f5;
+
+				.item {
+					padding: 20rpx 0;
+
+					.car-num {
+						background-color: #edf6ff;
+						color: #0080ff;
+						font-size: 38rpx;
+						padding: 15rpx 0;
+						text-align: center;
+						width: 100%;
+						border-radius: 10rpx;
+						font-weight: bold;
+					}
+
+					.p1 {
+						font-size: 28rpx;
+						color: #999;
+					}
+
+					.p2 {
+						font-size: 28rpx;
+						color: #191919;
+						font-weight: bold;
+						margin-left: 20rpx;
+					}
+				}
+
+				.car-num-item {
+					width: 100%;
+					display: flex;
+					align-items: center;
+					justify-content: center;
+				}
+			}
+
+			.b {
+				display: flex;
+				width: 100%;
+				align-items: center;
+				justify-content: space-between;
+
+				.btn {
+					height: 70rpx;
+					display: flex;
+					align-items: center;
+					justify-content: center;
+					width: calc(100% - 15rpx);
+					margin: 30rpx 0 0 0;
+					border-radius: 10rpx;
+					border-width: 1rpx;
+					box-sizing: border-box;
+				}
+
+				.b1 {
+					background-color: #0080ff;
+					color: #fff;
+				}
+
+				.b2 {
+					background-color: #f7f7f7;
+					color: #191919;
+				}
+
+				.b3 {
+					background-color: #fff;
+					color: #0080ff;
+					border: 1rpx solid #0080ff;
+				}
+
+				.b4 {
+					background-color: #ff0000;
+					color: #fff;
+				}
+			}
+		}
+	}
+
+	@import '@/common/common.scss'
+</style>

+ 248 - 0
app/pages/business-order/business-item.vue

@@ -0,0 +1,248 @@
+<template>
+	<view>
+		<view class="box">
+			<view class="top">
+				<text class="title">业务详情</text>
+			</view>
+		</view>
+		<view class="card-box">
+			<view class="card" v-for="(businessItem,index) in items" :key="businessItem.id">
+				<view class="t">
+					<image class="icon" src="../../static/home-icon-01.png"></image>
+					<text class="title">{{businessItem.itemTypeName}}</text>
+				</view>
+				<view class="c">
+					<view class="item car-num-item">
+						<text class="car-num">{{businessItem.itemName}}</text>
+					</view>
+				</view>
+				<view class="c">
+					<view class="item">
+						<text class="p1">录入时间:</text>
+						<text class="p2">{{businessItem.createTime}}</text>
+					</view>
+				</view>
+				<view class="c">
+					<view class="item">
+						<text class="p1">状态:</text>
+						<text class="p2">
+							<text v-if="businessItem.pick==1">已接单</text>
+							<text v-else>未接单</text>
+						</text>
+					</view>
+				</view>
+				<view class="c">
+					<view class="item" v-if="businessItem.pickTime">
+						<text class="p1">接单时间:</text>
+						<text class="p2">
+							<text>{{businessItem.pickTime}}</text>
+						</text>
+					</view>
+				</view>
+				<view class="c">
+					<view class="item" v-if="businessItem.pickCustomerName">
+						<text class="p1">接单企业:</text>
+						<text class="p2">
+							<text>{{businessItem.pickCustomerName}}</text>
+						</text>
+					</view>
+				</view>
+				<view class="c" v-if="businessItem.pick==1">
+					<view class="item" >
+						<text class="p1">确认状态:</text>
+						<text class="p2">
+							<text v-if="businessItem.confirm==1">已确认</text>
+							<text v-else>未确认</text>
+						</text>
+					</view>
+				</view>
+				<view class="c" v-if="businessItem.confirm==1">
+					<view class="item" >
+						<text class="p1">确认时间:</text>
+						<text class="p2">
+							<text>{{businessItem.confirmTime}}</text>
+						</text>
+					</view>
+				</view>
+				<view class="b" v-if="customerId!='1'&&businessItem.pick==1&&businessItem.confirm!=1">
+					<view class="btn b3"  @click="pickFn(businessItem.id)">
+						确认</view>
+				</view>
+			</view>
+		</view>
+
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				customerId:'',
+				form: {},
+				items:[],
+			}
+		},
+		onLoad(options) {
+			this.form.id = options.id;
+		},
+		onShow() {
+			this.customerId = uni.getStorageSync('customerId')
+			this.getBusinessById();
+		},
+		onBackPress() {
+			this.$common.to('/pages/index/index')
+			return true;
+		},
+		methods: {
+			getBusinessById() {
+				this.$api.getBusinessById({
+					id: this.form.id
+				}).then(resp => {
+					let data=resp.data;
+					this.items = resp.data.items.filter(obj=>obj.businessType!==0);
+				})
+			},
+			pickFn(id) {
+				let that = this;
+				uni.showModal({
+					title: '提示',
+					content: '是否确认该业务项?',
+					success(resp) {
+						if (resp.confirm) {
+							that.surePick(id);
+						}
+					}
+				})
+			},
+			surePick(id) {
+				this.$api.confirmBusinessItem({id: id}).then(resp => {
+					if (resp.code == 200) {
+						this.$common.toast('已确认');
+						this.getBusinessById();
+					}
+				})
+			}
+		}
+	}
+</script>
+
+<style lang="scss">
+	.card-box {
+		display: flex;
+		width: 100%;
+		flex-direction: column;
+
+		.card {
+			background-color: #fff;
+			border-radius: 20rpx;
+			margin: 20rpx 20rpx 0 20rpx;
+			padding: 30rpx;
+			box-sizing: border-box;
+			display: flex;
+			flex-direction: column;
+
+			.t {
+				width: 100%;
+				display: flex;
+				align-items: center;
+				padding-bottom: 30rpx;
+				border-bottom: 1rpx solid #f5f5f5;
+
+				.icon {
+					width: 40rpx;
+					height: 40rpx;
+				}
+
+				.title {
+					font-size: 35rpx;
+					font-weight: bold;
+					margin-left: 20rpx;
+				}
+			}
+
+			.c {
+				padding: 15rpx 0 30rpx 0;
+				display: flex;
+				flex-wrap: wrap;
+				border-bottom: 1rpx solid #f5f5f5;
+
+				.item {
+					padding: 20rpx 0;
+
+					.car-num {
+						background-color: #edf6ff;
+						color: #0080ff;
+						font-size: 38rpx;
+						padding: 15rpx 0;
+						text-align: center;
+						width: 100%;
+						border-radius: 10rpx;
+						font-weight: bold;
+					}
+
+					.p1 {
+						font-size: 28rpx;
+						color: #999;
+					}
+
+					.p2 {
+						font-size: 28rpx;
+						color: #191919;
+						font-weight: bold;
+						margin-left: 20rpx;
+					}
+				}
+
+				.car-num-item {
+					width: 100%;
+					display: flex;
+					align-items: center;
+					justify-content: center;
+				}
+			}
+
+			.b {
+				display: flex;
+				width: 100%;
+				align-items: center;
+				justify-content: space-between;
+
+				.btn {
+					height: 70rpx;
+					display: flex;
+					align-items: center;
+					justify-content: center;
+					width: calc(100% - 15rpx);
+					margin: 30rpx 0 0 0;
+					border-radius: 10rpx;
+					border-width: 1rpx;
+					box-sizing: border-box;
+				}
+
+				.b1 {
+					background-color: #0080ff;
+					color: #fff;
+				}
+
+				.b2 {
+					background-color: #f7f7f7;
+					color: #191919;
+				}
+
+				.b3 {
+					background-color: #fff;
+					color: #0080ff;
+					border: 1rpx solid #0080ff;
+				}
+
+				.b4 {
+					background-color: #ff0000;
+					color: #fff;
+				}
+			}
+		}
+	}
+
+	@import '@/common/common.scss'
+</style>

+ 6 - 1
app/pages/business-order/business-order.vue

@@ -49,10 +49,12 @@
 					</view>
 				</view>
 				<view class="b">
+					<view class="btn b3" @click="businessFn(businessItem)">
+						业务项</view>
 					<view class="btn b3" v-if="businessItem.payStatus==1
 								&&perList.indexOf('tb-business-confirm')!=-1
 								&&customemrId!='1'" @click="sureZdFn(businessItem)">
-						支付账单</view>
+						账单</view>
 					<view class="btn b3" v-if="customemrId!=='1'" @click="fkFn(businessItem)">
 						证明</view>
 						<view class="btn b3" @click="toDetail(businessItem)">详情</view>
@@ -115,6 +117,9 @@
 			return true;
 		},
 		methods: {
+			businessFn(data){
+				this.$common.to('/pages/business-order/business-item?id=' + data.id)	
+			},
 			toDetail(data) {
 				this.$common.to('/pages/business-entering/business-detail?id=' + data.id)
 			},

+ 221 - 0
app/pages/business-order/partner-business-item.vue

@@ -0,0 +1,221 @@
+<template>
+	<view>
+		<view class="box">
+			<view class="top">
+				<text class="title">业务详情</text>
+			</view>
+		</view>
+		<view class="card-box">
+			<view class="card" v-for="(businessItem,index) in items" :key="businessItem.id">
+				<view class="t">
+					<image class="icon" src="../../static/home-icon-01.png"></image>
+					<text class="title">{{businessItem.itemTypeName}}</text>
+				</view>
+				<view class="c">
+					<view class="item car-num-item">
+						<text class="car-num">{{businessItem.itemName}}</text>
+					</view>
+				</view>
+				<view class="c">
+					<view class="item">
+						<text class="p1">录入时间:</text>
+						<text class="p2">{{businessItem.createTime}}</text>
+					</view>
+				</view>
+				<view class="c">
+					<view class="item" v-if="businessItem.pickTime">
+						<text class="p1">接单时间:</text>
+						<text class="p2">
+							<text>{{businessItem.pickTime}}</text>
+						</text>
+					</view>
+				</view>
+				<view class="c" v-if="businessItem.pick==1">
+					<view class="item">
+						<text class="p1">客户确认:</text>
+						<text class="p2">
+							<text v-if="businessItem.confirm==1">已确认</text>
+							<text v-else>未确认</text>
+						</text>
+					</view>
+				</view>
+				<view class="c" v-if="businessItem.confirm==1">
+					<view class="item">
+						<text class="p1">确认时间:</text>
+						<text class="p2">
+							<text>{{businessItem.confirmTime}}</text>
+						</text>
+					</view>
+				</view>
+			</view>
+		</view>
+		<noData v-if="items.length==0"></noData>
+		<u-loadmore style="margin: 30rpx;" :status="status" />
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				customerId: '',
+				form: {},
+				items: [],
+				status: 'loadmore',
+				p: {
+					pageNo: 1,
+					pageSize: 3,
+					dataCount: 0
+				},
+			}
+		},
+		onShow() {
+			this.getPartnerBusinessItem();
+		},
+		onBackPress() {
+			this.$common.to('/pages/index/index')
+			return true;
+		},
+		methods: {
+			getPartnerBusinessItem() {
+				this.$api.getPartnerBusinessItem(this.p).then(resp => {
+					this.status = 'loadmore';
+					this.p.pageNo = resp.pageNo;
+					this.p.pageSize = resp.pageSize;
+					this.p.dataCount = resp.dataCount;
+					this.items = resp.data;
+				})
+			},
+			//上拉加载更多,分页模拟数据
+			onReachBottom() {
+				if (parseInt(this.p.dataCount) > parseInt(this.p.pageSize) * parseInt(this.p.pageNo)) {
+					this.status = 'loading';
+					this.p.pageSize += 5;
+					this.getPartnerBusinessItem();
+				} else {
+					this.status = 'nomore';
+				}
+			}
+		}
+	}
+</script>
+
+<style lang="scss">
+	.card-box {
+		display: flex;
+		width: 100%;
+		flex-direction: column;
+
+		.card {
+			background-color: #fff;
+			border-radius: 20rpx;
+			margin: 20rpx 20rpx 0 20rpx;
+			padding: 30rpx;
+			box-sizing: border-box;
+			display: flex;
+			flex-direction: column;
+
+			.t {
+				width: 100%;
+				display: flex;
+				align-items: center;
+				padding-bottom: 30rpx;
+				border-bottom: 1rpx solid #f5f5f5;
+
+				.icon {
+					width: 40rpx;
+					height: 40rpx;
+				}
+
+				.title {
+					font-size: 35rpx;
+					font-weight: bold;
+					margin-left: 20rpx;
+				}
+			}
+
+			.c {
+				padding: 15rpx 0 30rpx 0;
+				display: flex;
+				flex-wrap: wrap;
+				border-bottom: 1rpx solid #f5f5f5;
+
+				.item {
+					padding: 20rpx 0;
+
+					.car-num {
+						background-color: #edf6ff;
+						color: #0080ff;
+						font-size: 38rpx;
+						padding: 15rpx 0;
+						text-align: center;
+						width: 100%;
+						border-radius: 10rpx;
+						font-weight: bold;
+					}
+
+					.p1 {
+						font-size: 28rpx;
+						color: #999;
+					}
+
+					.p2 {
+						font-size: 28rpx;
+						color: #191919;
+						font-weight: bold;
+						margin-left: 20rpx;
+					}
+				}
+
+				.car-num-item {
+					width: 100%;
+					display: flex;
+					align-items: center;
+					justify-content: center;
+				}
+			}
+
+			.b {
+				display: flex;
+				width: 100%;
+				align-items: center;
+				justify-content: space-between;
+
+				.btn {
+					height: 70rpx;
+					display: flex;
+					align-items: center;
+					justify-content: center;
+					width: calc(100% - 15rpx);
+					margin: 30rpx 0 0 0;
+					border-radius: 10rpx;
+					border-width: 1rpx;
+					box-sizing: border-box;
+				}
+
+				.b1 {
+					background-color: #0080ff;
+					color: #fff;
+				}
+
+				.b2 {
+					background-color: #f7f7f7;
+					color: #191919;
+				}
+
+				.b3 {
+					background-color: #fff;
+					color: #0080ff;
+					border: 1rpx solid #0080ff;
+				}
+
+				.b4 {
+					background-color: #ff0000;
+					color: #fff;
+				}
+			}
+		}
+	}
+
+	@import '@/common/common.scss'
+</style>

+ 68 - 0
app/pages/home/home.vue

@@ -0,0 +1,68 @@
+<template>
+	<view class="box">
+
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				id:''
+			}
+		},
+		onLoad(options) {
+			this.id=options.id;
+		},
+		created() {
+			this.$common.showLoading('正在加载...')
+		},
+		mounted() {
+			this.getRedirectUri();
+		},
+		beforeDestroy() {
+			this.$common.hidingLoading()
+		},
+		methods: {
+			getRedirectUri() {
+				this.$api.getRedirectUrl({path:'/pages/index/index',state:this.id}).then(resp => {
+					window.location.href = resp.data;
+				})
+			}
+		}
+	}
+</script>
+
+<style lang="scss">
+	page {
+		background-color: #fff;
+	}
+
+	.box {
+		display: flex;
+		flex: 1;
+		align-items: center;
+		justify-content: center;
+		flex-direction: column;
+		padding: 100rpx 0;
+
+		.text {
+			color: #191919;
+			font-size: 36rpx;
+			font-weight: bold;
+			margin-top: 40rpx;
+		}
+
+		.count-down-box {
+			display: flex;
+			flex: 1;
+			align-items: center;
+			justify-content: center;
+			margin-top: 30rpx;
+
+			text {
+				margin-left: 20rpx;
+			}
+		}
+	}
+</style>

+ 47 - 2
app/pages/index/index.vue

@@ -52,17 +52,62 @@
 				companyName: '',
 				customerId: '',
 				qrcoderlc: '../../static/qrcode.png',
-				indexItemList: []
+				indexItemList: [],
+				code: '',
+				state: '',
+				userType: 1
 			}
 		},
+		onLoad(options) {
+			this.code = options.code;
+			this.state = options.state;
+			this.getOpenidByCode();
+
+		},
 		onShow() {
 			this.getStoreInfo();
 			this.setList();
+			this.checkUserType();
 		},
 		onBackPress() {
 			return true;
 		},
 		methods: {
+			getOpenidByCode() {
+				if (!this.code) {
+					this.$common.to('/pages/home/home')
+					return;
+				}
+				let storeOpenid = uni.getStorageSync('openid');
+				this.$api.getOpenidByCode({
+					code: this.code,
+					openid: storeOpenid
+				}).then(resp => {
+					let openid = resp.data;
+					this.openid = openid;
+					if (openid) {
+						uni.setStorageSync('openid', openid)
+					}
+
+				})
+			},
+			checkUserType() {
+				let token = uni.getStorageSync('token');
+				if (token) {
+					this.$api.checkUserType().then(resp => {
+						let userType = resp.data;
+						if (userType == 3) {
+							this.indexItemList = [{
+								auth: true,
+								icon: '../../static/home-icon-03.png',
+								text: '我的业务',
+								url: '/pages/business-order/partner-business-item',
+								show: true
+							}]
+						}
+					})
+				}
+			},
 			setList() {
 				this.indexItemList = [{
 						auth: false,
@@ -113,7 +158,6 @@
 						url: '/pages/inout-record/inout-record',
 						show: true
 					},
-
 					// {
 					// 	auth: true,
 					// 	icon: '../../static/home-icon-06.jpg',
@@ -145,6 +189,7 @@
 				uni.removeStorageSync('info')
 				this.isLogin = false;
 				this.setList();
+				this.$common.to('/pages/login/login')
 			},
 			navTo(item) {
 				let auth = item.auth;

+ 1 - 7
app/pages/login/login.vue

@@ -17,13 +17,6 @@
 					<u-input v-model="form.password" placeholder="输入密码" type="password"/>
 				</view>
 			</view>
-		<!-- 	<view class="item">
-				<view class="l">验证码:</view>
-				<view class="r">
-					<u-input placeholder="输入验证码"/>
-					<view class="btn">发送</view>
-				</view>
-			</view> -->
 		</view>
 		<view class="common-btn" @click="sliderVerifyFLag = true">确认登录</view>
 		<slider-verify :isShow="sliderVerifyFLag" @touchSliderResult="verifyResult" ref="verifyElement"></slider-verify>
@@ -51,6 +44,7 @@
 					this.$common.toast('请输入密码');
 					return;
 				}
+				this.form.openid=uni.getStorageSync('openid');
 				this.$api.doLogin(this.form).then(resp=>{
 					let data=resp.data;
 					if(data.tokenInfo){

+ 314 - 0
app/pages/partner/index.vue

@@ -0,0 +1,314 @@
+<template>
+	<view>
+		<view class="top-nav">
+			<view class="l">
+				<block v-if="isLogin">
+					<image class="user-img" src="../../static/user.png" @click="toAccount"></image>
+					<view class="l-r">
+						<text class="u-name">{{userName}}</text>
+						<text class="c-name" v-if="customerId!=='1'">{{companyName}}</text>
+					</view>
+				</block>
+				<block v-else>
+					<view class="login-btn" @click="toLogin">登录</view>
+				</block>
+			</view>
+			<view class="r" v-if="isLogin">
+				<view class="l-out" @click="exitFn">
+					退出登录
+				</view>
+			</view>
+		</view>
+		<view class="top-bg"></view>
+		<view class="top">
+			<text class="title">场站管理系统</text>
+		</view>
+		<view class="item-box">
+			<view class="item" hover-class="hover-class" v-for="(indexItem,index) in indexItemList" :key="index"
+				@click="navTo(indexItem)" v-show="indexItem.show">
+				<image class="icon" :src="indexItem.icon"></image>
+				<view class="text">
+					<text v-if="indexItem.text=='企业管理'&&customerId!='1'">信息管理</text>
+					<text v-else>{{indexItem.text}}</text>
+				</view>
+			</view>
+		</view>
+		<view class="qrcode">
+			<image class="qrcode" :src="qrcoderlc"></image>
+			<text class="text">长按二维码保存分享</text>
+		</view>
+		<view style="text-align: center;font-size: 23rpx;">
+			<a href="https://beian.miit.gov.cn/" target="_blank">桂ICP备12007573号-1</a>
+		</view>
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				isLogin: false, //是否登录状态
+				userName: '',
+				companyName: '',
+				customerId: '',
+				qrcoderlc: '../../static/qrcode.png',
+				indexItemList: []
+			}
+		},
+		onShow() {
+			this.getStoreInfo();
+			this.setList();
+		},
+		onBackPress() {
+			return true;
+		},
+		methods: {
+			setList() {
+				this.indexItemList = [{
+						auth: false,
+						icon: '../../static/home-icon-01.png',
+						text: '企业注册',
+						url: '/pages/enterprise-reg/enterprise-reg',
+						show: uni.getStorageSync('info') ? false : true
+					},
+					{
+						auth: false,
+						icon: '../../static/home-icon-07.jpg',
+						text: '申报录入',
+						url: '/pages/declare/add',
+						show: true
+					},
+					{
+						auth: false,
+						icon: '../../static/home-icon-06.jpg',
+						text: '消杀申报',
+						url: '/pages/disinfect/addDisinfect',
+						show: true
+					},
+					{
+						auth: true,
+						icon: '../../static/home-icon-02.png',
+						text: '业务录入',
+						url: '/pages/business-entering/business-entering',
+						show: uni.getStorageSync('perList').indexOf('tb-business-add') !== -1
+					},
+					{
+						auth: true,
+						icon: '../../static/home-icon-03.png',
+						text: '业务订单',
+						url: '/pages/business-order/business-order',
+						show: true
+					},
+					{
+						auth: true,
+						icon: '../../static/home-icon-04.png',
+						text: '企业管理',
+						url: '/pages/customer-management/customer-list',
+						show: true
+					},
+					{
+						auth: true,
+						icon: '../../static/home-icon-05.png',
+						text: '出入记录',
+						url: '/pages/inout-record/inout-record',
+						show: true
+					},
+
+					// {
+					// 	auth: true,
+					// 	icon: '../../static/home-icon-06.jpg',
+					// 	text: '账户充值',
+					// 	url: '/pages/account/index',
+					// 	show:true
+					// },
+
+				]
+			},
+			toAccount() {
+				if (this.customerId !== '1') {
+					this.$common.to('/pages/account/account-redirect')
+				}
+			},
+			getStoreInfo() {
+				let info = uni.getStorageSync('info');
+				if (info) {
+					this.isLogin = true;
+					this.userName = info.name;
+					this.customerId = info.customerId;
+				}
+			},
+			toLogin() {
+				this.$common.to('/pages/login/login')
+			},
+			exitFn() {
+				uni.removeStorageSync('token')
+				uni.removeStorageSync('info')
+				this.isLogin = false;
+				this.setList();
+			},
+			navTo(item) {
+				let auth = item.auth;
+				let token = uni.getStorageSync('token');
+				if (!auth || token) {
+					this.$common.to(item.url)
+				} else {
+					this.$common.to('/pages/login/login')
+				}
+			}
+		}
+	}
+</script>
+
+<style lang="scss">
+	page {
+		background-color: #fff;
+	}
+
+	.top-nav {
+		position: fixed;
+		top: 0;
+		left: 0;
+		right: 0;
+		z-index: 999;
+		display: flex;
+		align-items: center;
+		justify-content: space-between;
+		padding: 20rpx 0;
+		background-color: #0080ff;
+
+		.l {
+			display: flex;
+			align-items: center;
+
+			.login-btn {
+				border: 1rpx solid #359aff;
+				border-radius: 8rpx;
+				color: #fff;
+				padding: 10rpx 20rpx;
+				font-size: 28rpx;
+				margin-left: 30rpx;
+			}
+
+			.user-img {
+				width: 80rpx;
+				height: 80rpx;
+				border-radius: 50%;
+				margin-left: 30rpx;
+				margin: 20rpx;
+			}
+
+			.l-r {
+				display: flex;
+				flex-direction: column;
+
+				.u-name {
+					font-size: 30rpx;
+					color: #fff;
+					font-weight: bold;
+				}
+
+				.c-name {
+					font-size: 24rpx;
+					color: #fff;
+				}
+			}
+		}
+
+		.r {
+			display: flex;
+			align-items: center;
+
+			.l-out {
+				border: 1rpx solid #359aff;
+				border-radius: 8rpx;
+				color: #c8e4ff;
+				padding: 10rpx 20rpx;
+				font-size: 28rpx;
+				margin-right: 30rpx;
+			}
+		}
+	}
+
+	.top-bg {
+		position: relative;
+		top: 0;
+		left: 0;
+		right: 0;
+		height: 400rpx;
+		background-color: #0080ff;
+		border-radius: 0 0 20rpx 20rpx;
+	}
+
+	.top {
+		display: flex;
+		width: 100%;
+		align-items: center;
+		justify-content: center;
+		margin: 60rpx 0;
+		margin-top: -400rpx;
+		position: relative;
+		z-index: 2;
+
+		.title {
+			font-size: 50rpx;
+			font-weight: bold;
+			color: #fff;
+		}
+	}
+
+	.item-box {
+		display: flex;
+		flex-wrap: wrap;
+		align-content: flex-start;
+		padding: 40rpx;
+		box-sizing: border-box;
+		background-color: #fff;
+		margin: 0 30rpx;
+		border-radius: 20rpx;
+		position: relative;
+		z-index: 2;
+		//height: calc(100vh - 170rpx - 500rpx);
+		box-shadow: 0 10rpx 30rpx rgba(0, 0, 0, 0.03);
+
+		.item {
+			width: 33.333%;
+			display: flex;
+			flex-direction: column;
+			align-items: center;
+			justify-content: center;
+			padding: 40rpx 0;
+
+			.icon {
+				width: 90rpx;
+				height: 90rpx;
+			}
+
+			.text {
+				font-size: 28rpx;
+				color: #191919;
+				margin-top: 20rpx;
+			}
+		}
+	}
+
+	.qrcode {
+		display: flex;
+		width: 100%;
+		flex-direction: column;
+		align-items: center;
+		justify-content: center;
+		margin: 30rpx 0;
+
+		.qrcode {
+			width: 350rpx;
+			height: 350rpx;
+			border: 1px solid #191919;
+		}
+
+		.text {
+			color: #191919;
+			font-size: 28rpx;
+			margin-top: 5rpx;
+		}
+	}
+</style>

+ 2 - 2
app/utils/request.js

@@ -1,6 +1,6 @@
-// const server = 'http://127.0.0.1:8099/pro';
+const server = 'http://127.0.0.1:8099/pro';
 // const server = 'http://47.101.143.145/pro';
-const server = 'https://dxkaa1.bgigc.com/pro';
+// const server = 'https://dxkaa1.bgigc.com/pro';
 
 import common from '../common/js/common.js';
 

+ 12 - 21
sp-admin/sa-frame/menu-list.js

@@ -29,13 +29,22 @@ var menuList =	[
 	},
 	{
 		id: 'tb-partner',
-		name: '合作伙伴管理',
+		name: '合作伙伴',
 		icon: 'el-icon-s-custom',
 		childList: [
 			{id: 'tb-costomer-partner', name: '合作伙伴', url: 'sa-view/tb-partner/tb-partner-list.html'},
 		]
 	},
 	{
+		id: 'tb-business-item',
+		name: '业务管理',
+		icon: 'el-icon-edit-outline',
+		info: '我的业务',
+		childList: [
+			{id: 'tb-business-item-list', name: '我的业务', url: 'sa-view/tb-partner/tb-business-item-list.html'},
+		]
+	},
+	{
 		id: 'tb-business',
 		name: '业务录入',
 		icon: 'el-icon-edit-outline',
@@ -47,26 +56,8 @@ var menuList =	[
 			{id: 'tb-business-pay', name: '业务支付', url: 'sa-view/tb-business/tb-business-list.html', isShow: false},
 		]
 	},
-	
-	{
-		id: 'tb-car',
-		name: '车辆管理',
-		icon: 'el-icon-truck',
-		info: '表数据的维护',
-		childList: [
-			{id: 'tb-car-list', name: '车辆-列表', url: 'sa-view/tb-car/tb-car-list.html'},
-			{id: 'tb-car-add', name: '车辆-添加', url: 'sa-view/tb-car/tb-car-add.html'},
-		]
-	},
-	// {
-	// 	id: 'tb-pass-record',
-	// 	name: '放行记录-旧',
-	// 	icon: 'el-icon-notebook-2',
-	// 	info: '放行日志表数据的维护',
-	// 	childList: [
-	// 		{id: 'tb-pass-record-list', name: '放行列表', url: 'sa-view/tb-pass-record/tb-pass-record-list.html'},
-	// 	]
-	// },
+
+
 	{
 		id: 'tb-business-car',
 		name: '放行记录',

+ 38 - 14
sp-admin/sa-view/tb-item/tb-item-list.html

@@ -32,23 +32,25 @@
 					<sa-td name="项目编号" prop="code"></sa-td>
 					<sa-td name="收费项" prop="code">
 						<template slot-scope="s">
-							  <el-select v-model="s.row.items[0].id" placeholder="收费项">
-							    <el-option
-							      v-for="item in s.row.items"
-							      :key="item.id"
-								  :value="item.id"
-							      :label="item.itemName+' '+item.price+item.unit">
-							    </el-option>
-							  </el-select>
+							<el-select v-model="s.row.items[0].id" placeholder="收费项">
+								<el-option v-for="item in s.row.items" :key="item.id" :value="item.id"
+									:label="item.itemName+' '+item.price+item.unit">
+								</el-option>
+							</el-select>
 						</template>
 					</sa-td>
-				<!-- 	<el-table-column label="操作" fixed="right" width="240px">
+					<sa-td name="业务类型" prop="businessType">
 						<template slot-scope="s">
-							<el-button class="c-btn" type="success" icon="el-icon-view" @click="get(s.row)">查看
-							</el-button>
-							<el-button class="c-btn" type="primary" icon="el-icon-edit" @click="update(s.row)">修改
-							</el-button>
-							<el-button class="c-btn" type="danger" icon="el-icon-delete" @click="del(s.row)">删除
+							<el-select v-model="s.row.businessType" placeholder="收费项" @change="businessChange(s.row)">
+								<el-option v-for="item in businessTypeList" :key="item.value" :value="item.value"
+									:label="item.name">
+								</el-option>
+							</el-select>
+						</template>
+					</sa-td>
+					<!-- <el-table-column label="操作" fixed="right" width="240px">
+						<template slot-scope="s">
+							<el-button class="c-btn" type="primary" icon="el-icon-edit" @click="update(s.row)">详细
 							</el-button>
 						</template>
 					</el-table-column> -->
@@ -76,8 +78,30 @@
 					dataCount: 0,
 					dataList: [], // 数据集合
 					itemTypeList: [],
+					businessTypeList: [{
+							value: 0,
+							name: '默认'
+						},
+						{
+							value: 1,
+							name: '消杀'
+						},
+						{
+							value: 2,
+							name: '装卸'
+						},
+					]
 				},
 				methods: {
+					businessChange(data) {
+						let obj={
+							id:data.id,
+							businessType:data.businessType
+						}
+						sa.ajax('/TbItemType/update', obj, function(res) {
+							this.f5();
+						}.bind(this));
+					},
 					// 刷新
 					f5: function() {
 						sa.ajax('/TbItemType/getList', sa.removeNull(this.p), function(res) {

+ 2 - 13
sp-admin/sa-view/tb-partner/customer-admin-add.html

@@ -29,13 +29,6 @@
 					<sa-item type="text" name="用户名" v-model="m.name" placeholder="请输入用户名" br></sa-item>
 					<sa-item type="password" name="密码" v-model="m.password" placeholder="请输入密码" br></sa-item>
 					<sa-item type="password" name="再输一次" v-model="m.againPassword" placeholder="请再输一次密码" br></sa-item>
-					<div class="c-item">
-						<label class="c-label"><span style="color: red;">*</span>角色:</label>
-					<el-select v-model="m.roleIds" multiple>
-						<el-option label="请选择" :value="0" disabled></el-option>
-						<el-option v-for="role in roleList" :key="role.id" :label="role.name" :value="role.id"></el-option>
-					</el-select>
-					</div>
 					<sa-item name="" br>
 						<el-button type="primary" icon="el-icon-plus" @click="ok()">保存</el-button>
 					</sa-item>
@@ -75,13 +68,9 @@
 							sa.error('两次输入密码不一致');
 							return ;
 						}
-						if(m.roleIds.length==0){
-							sa.error('请选择角色');
-							return ;
-						}
-						m.roleId=m.roleIds.join(',')
+						m.roleId=3;
 						// 添加
-						sa.ajax('/admin/addCustomerAdmin', m, function(res){
+						sa.ajax('/admin/addPartnerAdmin', m, function(res){
 							sa.alert('增加成功', this.clean); 
 						
 						}.bind(this));

+ 1 - 7
sp-admin/sa-view/tb-partner/customer-admin-list.html

@@ -39,11 +39,8 @@
 					<sa-td type="datetime" name="最后登录" prop="loginTime" width="150px"></sa-td>
 					<sa-td type="text" name="登录次数" prop="loginCount" not="0" width="100px"></sa-td>
 					<sa-td type="switch" name="账号状态" prop="status" :jv="{1: '正常', 2: '禁用[#ff4949]'}" @change="s => updateStatus(s.row)" width="120px"></sa-td>
-					<el-table-column label="操作" fixed="right" width="450px">
+					<el-table-column label="操作"  width="450px">
 						<template slot-scope="s">
-							<span @click="getInfo(s.row)">
-								<el-button type="success" class="c-btn" icon="el-icon-view">查看</el-button>
-							</span>
 							<span @click="updateName(s.row)">
 								<el-button type="primary" class="c-btn" icon="el-icon-edit">改名称</el-button>
 							</span>
@@ -53,9 +50,6 @@
 							<span @click="updatePassword(s.row)">
 								<el-button type="primary" class="c-btn" icon="el-icon-edit">改密码</el-button>
 							</span>
-							<span @click="roleFn(s.row)">
-								<el-button type="primary" class="c-btn" icon="el-icon-edit">角色</el-button>
-							</span>
 							<span @click="del(s.row)">
 								<el-button type="danger" class="c-btn" icon="el-icon-delete">删除</el-button>
 							</span>

+ 124 - 0
sp-admin/sa-view/tb-partner/tb-business-item-list.html

@@ -0,0 +1,124 @@
+<!DOCTYPE html>
+<html>
+	<head>
+		<title>业务作业项-列表</title>
+		<meta charset="utf-8">
+		<meta name="viewport"
+			content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
+		<!-- 所有的 css & js 资源 -->
+		<link rel="stylesheet" href="../../static/kj/element-ui/theme-chalk/index.css">
+		<link rel="stylesheet" href="../../static/sa.css">
+		<script src="../../static/kj/vue.min.js"></script>
+		<script src="../../static/kj/element-ui/index.js"></script>
+		<script src="../../static/kj/httpVueLoader.js"></script>
+		<script src="../../static/kj/jquery.min.js"></script>
+		<script src="../../static/kj/layer/layer.js"></script>
+		<script src="../../static/sa.js"></script>
+	</head>
+	<body>
+		<div class="vue-box" style="display: none;" :style="'display: block;'">
+			<div class="c-panel">
+				<!-- ------------- 检索参数 ------------- -->
+				<div class="c-title">检索参数</div>
+				<el-form ref="form" :model='p' @submit.native.prevent>
+					<sa-item type="text" name="项目名称" v-model="p.itemName"></sa-item>
+					<el-button type="primary" icon="el-icon-search" @click="p.pageNo = 1; f5()">查询</el-button>
+					<el-button style="display: inline;" type="info" icon="el-icon-refresh" @click="sa.f5()">重置
+					</el-button>
+				</el-form>
+				<!-- ------------- 快捷按钮 ------------- -->
+
+				<!-- ------------- 数据列表 ------------- -->
+				<el-table class="data-table" ref="data-table" :data="dataList">
+					<sa-td name="项目类型" prop="itemTypeName"></sa-td>
+					<sa-td name="具体项目" prop="itemName"></sa-td>
+					<sa-td name="计费标准" prop="unit">
+						<template slot-scope="s">
+							{{s.row.itemPrice}}{{s.row.unit}}
+						</template>
+					</sa-td>
+				<!-- 	<sa-td name="状态" prop="status" type="enum" :jv="{0: '未完成', 1: '已完成'}"></sa-td>
+					<sa-td name="作业时间" prop="operateTime"></sa-td> -->
+					<sa-td name="创建时间" prop="createTime"></sa-td>
+					<sa-td name="接单时间" prop="pickTime"></sa-td>
+					<!-- <el-table-column label="操作" fixed="right" width="200px">
+						<template slot-scope="s">
+							<el-button class="c-btn" type="success" icon="el-icon-view" @click="get(s.row)">查看
+							</el-button>
+							<el-button class="c-btn" type="primary" icon="el-icon-edit" @click="update(s.row)">修改
+							</el-button>
+						</template>
+					</el-table-column> -->
+				</el-table>
+				<!-- ------------- 分页 ------------- -->
+				<sa-item type="page" :curr.sync="p.pageNo" :size.sync="p.pageSize" :total="dataCount" @change="f5()">
+				</sa-item>
+			</div>
+		</div>
+		<script>
+			var app = new Vue({
+				components: {
+					"sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue'),
+					"sa-td": httpVueLoader('../../sa-frame/com/sa-td.vue'),
+				},
+				el: '.vue-box',
+				data: {
+					p: { // 查询参数  
+						id: '', // 主键 
+						itemName: '', // 项目名称 
+						pageNo: 1, // 当前页 
+						pageSize: 10, // 页大小 
+						sortType: 9 // 排序方式 
+					},
+					dataCount: 0,
+					dataList: [], // 数据集合 
+				},
+				methods: {
+					// 刷新
+					f5: function() {
+						sa.ajax('/TbBusinessItem/getList', sa.removeNull(this.p), function(res) {
+							this.dataList = res.data; // 数据
+							this.dataCount = res.dataCount; // 数据总数 
+							sa.f5TableHeight(); // 刷新表格高度 
+						}.bind(this));
+					},
+					// 查看
+					get: function(data) {
+						sa.showIframe('数据详情', 'tb-business-item-info.html?id=' + data.id, '1050px', '90%');
+					},
+					// 查看 - 根据选中的
+					getBySelect: function(data) {
+						var selection = this.$refs['data-table'].selection;
+						if (selection.length == 0) {
+							return sa.msg('请选择一条数据')
+						}
+						this.get(selection[0]);
+					},
+					// 批量删除
+					deleteByIds: function() {
+						// 获取选中元素的id列表 
+						let selection = this.$refs['data-table'].selection;
+						let ids = sa.getArrayField(selection, 'id');
+						if (selection.length == 0) {
+							return sa.msg('请至少选择一条数据')
+						}
+						// 提交删除 
+						sa.confirm('是否批量删除选中数据?此操作不可撤销', function() {
+							sa.ajax('/TbBusinessItem/deleteByIds', {
+								ids: ids.join(',')
+							}, function(res) {
+								sa.arrayDelete(this.dataList, selection);
+								sa.ok('删除成功');
+								sa.f5TableHeight(); // 刷新表格高度 
+							}.bind(this))
+						}.bind(this));
+					},
+				},
+				created: function() {
+					this.f5();
+					sa.onInputEnter();
+				}
+			})
+		</script>
+	</body>
+</html>

+ 0 - 232
sp-admin/sa-view/tb-partner/tb-costomer-judge.html

@@ -1,232 +0,0 @@
-<!DOCTYPE html>
-<html>
-	<head>
-		<title>客户审核</title>
-		<meta charset="utf-8">
-		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
-		<!-- 所有的 css & js 资源 -->
-		<link rel="stylesheet" href="../../static/kj/element-ui/theme-chalk/index.css">
-		<link rel="stylesheet" href="../../static/sa.css">
-		<script src="../../static/kj/vue.min.js"></script>
-		<script src="../../static/kj/element-ui/index.js"></script>
-		<script src="../../static/kj/httpVueLoader.js"></script>
-		<script src="../../static/kj/jquery.min.js"></script>
-		<script src="../../static/kj/layer/layer.js"></script>
-		<script src="../../static/sa.js"></script>
-	</head>
-	<body>
-		<div class="vue-box" style="display: none;" :style="'display: block;'">
-			<div class="c-panel">
-				<!-- ------------- 检索参数 ------------- -->
-				<div class="c-title">检索参数</div>
-				<el-form ref="form" :model='p' @submit.native.prevent>
-					<sa-item type="text" name="名称" v-model="p.name"></sa-item>
-					<sa-item type="text" name="联系号码" v-model="p.phone"></sa-item>
-					<sa-item type="text" name="负责人" v-model="p.dutyPeople"></sa-item>
-					<el-button type="primary" icon="el-icon-search" @click="p.pageNo = 1; f5()">查询</el-button>
-					<br />
-					<sa-item name="综合排序">
-						<el-radio-group v-model="p.sortType" class="s-radio-text">
-							<el-radio :label="0">默认</el-radio>
-							<el-radio :label="2">名称</el-radio>
-							<el-radio :label="8">创建时间</el-radio>
-						</el-radio-group>
-					</sa-item>
-				</el-form>
-				<el-button type="success" icon="el-icon-view" @click="getBySelect()" >查看</el-button>
-				<el-button type="info"  icon="el-icon-refresh"  @click="sa.f5()">重置</el-button>
-				<!-- ------------- 数据列表 ------------- -->
-				<el-table class="data-table" ref="data-table" :data="dataList" >
-					<sa-td type="selection"></sa-td>
-					<sa-td name="名称" prop="name" ></sa-td>
-					<sa-td name="联系号码" prop="phone" ></sa-td>
-					<sa-td name="负责人" prop="dutyPeople" ></sa-td>
-					<sa-td name="结算类型" prop="payType" type="enum" :jv="{1: '现结', 2: '月结'}"></sa-td>
-					<sa-td name="地址" prop="addressStr" ></sa-td>
-					<sa-td name="营业执照" prop="businessLicence" type="img"></sa-td>
-					<sa-td name="创建时间" prop="creareTime" ></sa-td>
-					<sa-td name="审核状态" prop="judgeStatus" type="enum" :jv="{1: '未审核', 2: '已通过', 3: '不通过'}"></sa-td>
-					<el-table-column label="操作" fixed="right"  width="280px">
-						<template slot-scope="s">
-							<el-button class="c-btn" type="success" icon="el-icon-view" @click="get(s.row)">查看</el-button>
-							<el-button class="c-btn" type="success" icon="el-icon-view" @click="judgeFn(s.row)">
-								审核
-							</el-button>
-						</template>
-					</el-table-column>
-				</el-table>
-				<!-- ------------- 分页 ------------- -->
-				<sa-item type="page" :curr.sync="p.pageNo" :size.sync="p.pageSize" :total="dataCount" @change="f5()"></sa-item>
-			</div>
-			<el-dialog title="审核"  :visible="modal.visible" width="500px">
-				<el-form size="mini">
-					<div class="c-item br">
-						<label class="c-label"><label style="color: red">*</label>审核意见:</label>
-						<el-input placeholder="请输入审核意见" v-model="modal.form.judgeContent"></el-input>
-					</div>
-				</el-form>
-				<span slot="footer" class="dialog-footer">
-					<el-button  @click="closeFn">关闭</el-button>
-					<el-button type="danger" @click="sureJudge(3)">不通过</el-button>
-					<el-button type="primary" @click="sureJudge(2)">通过</el-button>
-				</span>
-			</el-dialog>
-		</div>
-		<script>
-			var app = new Vue({
-				components: {
-					"sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue'),  
-					"sa-td": httpVueLoader('../../sa-frame/com/sa-td.vue'),		
-				},
-				el: '.vue-box',
-				data: {
-					modal:{
-					visible:false,
-						form:{
-							id:'',
-							judgeContent:'审核通过'
-						}
-					},
-					p: { // 查询参数  
-						id: '',		// 主键 
-						name: '',		// 名称 
-						phone: '',		// 联系号码 
-						dutyPeople: '',		// 负责人 
-						addressIds: '',		// 地址id 
-						addressStr: '',		// 地址 
-						status: '',		// 状态(0=否,1=是) 
-						creareTime: '',		// 创建时间 
-						judgeStatus: '',		// 审核状态(1=未审核,2审核通过,3审核不通过) 
-						judgeTime: '',		// 审核时间 
-						judgeContent: '',		// 审核意见 
-						pageNo: 1,		// 当前页 
-						pageSize: 10,	// 页大小 
-						sortType: 0		// 排序方式 
-					},
-					dataCount: 0,
-					dataList: [], // 数据集合 
-					currentCustomerId:'1',
-				},
-				methods: {
-					closeFn(){
-						this.modal.visible=false;
-					},
-					judgeFn(data){
-						Object.assign(this.modal,{
-							visible:true,
-							form:{
-								id:data.id,
-								judgeContent:data.judgeContent,
-								judgeStatus:data.judgeStatus
-							}
-						})
-					},
-					sureJudge(status){
-						if(this.modal.form.judgeStatus==2){
-							sa.error('已审核通过,无需再审核')
-							return;
-						}
-						let content="审核通过";
-						if(status==3){
-							if(!this.modal.form.judgeContent){
-								sa.error('请输入审核意见');
-								return;
-							}
-						}else{
-						this.modal.form.judgeContent=content;
-						}
-						this.modal.form.judgeStatus=status;
-						sa.ajax('/TbCostomer/judge',this.modal.form,function(resp){
-							this.modal.visible=false;
-							this.f5();
-						}.bind(this))
-					},
-					getCustomer(){
-						sa.ajax('/TbCostomer/getCurrentCustomerId', function(resp) {
-							this.currentCustomerId=resp.data;
-						}.bind(this));
-					},
-					userFn(data){
-							sa.showIframe('企业用户', 'customer-admin-list.html?customerId=' + data.id, '1050px', '90%');
-					},
-					// 刷新
-					f5: function() {
-						sa.ajax('/TbCostomer/getList', sa.removeNull(this.p), function(res) {
-							this.dataList = res.data; // 数据
-							this.dataCount = res.dataCount; // 数据总数 
-							sa.f5TableHeight();		// 刷新表格高度 
-						}.bind(this));
-					},
-					// 查看
-					get: function(data) {
-						sa.showIframe('数据详情', 'tb-costomer-info.html?id=' + data.id, '1050px', '90%');
-					},
-					// 查看 - 根据选中的
-					getBySelect: function(data) {
-						var selection = this.$refs['data-table'].selection;
-						if(selection.length == 0) {
-							return sa.msg('请选择一条数据')
-						}
-						this.get(selection[0]);
-					},
-					// 修改
-					update: function(data) {
-						sa.showIframe('修改数据', 'tb-costomer-add.html?id=' + data.id, '1000px', '90%');
-					},
-					// 新增
-					add: function(data) {
-						sa.showIframe('新增数据', 'tb-costomer-add.html?id=-1', '550px', '80%');
-					},
-					// 删除
-					del: function(data) {
-						sa.confirm('是否删除,此操作不可撤销', function() {
-							sa.ajax('/TbCostomer/delete?id=' + data.id, function(res) {
-								sa.arrayDelete(this.dataList, data);
-								sa.ok('删除成功');
-								sa.f5TableHeight();		// 刷新表格高度 
-							}.bind(this))
-						}.bind(this));
-					},
-					// 批量删除
-					deleteByIds: function() {
-						// 获取选中元素的id列表 
-						let selection = this.$refs['data-table'].selection;
-						let ids = sa.getArrayField(selection, 'id');
-						if(selection.length == 0) {
-							return sa.msg('请至少选择一条数据')
-						}
-						// 提交删除 
-						sa.confirm('是否批量删除选中数据?此操作不可撤销', function() {
-							sa.ajax('/TbCostomer/deleteByIds', {ids: ids.join(',')}, function(res) {
-								sa.arrayDelete(this.dataList, selection);
-								sa.ok('删除成功');
-								sa.f5TableHeight();		// 刷新表格高度 
-							}.bind(this))
-						}.bind(this));
-					},
-					// 改 - 状态(0=否,1=是)
-					updateStatus: function(data) {
-						// 声明变量记录是否成功 
-						var isOk = false;	
-						var oldValue = data.status;
-						var ajax = sa.ajax('/TbCostomer/updateStatus', {id: data.id, value: data.status}, function(res) {
-							isOk = true;
-							sa.msg('修改成功');
-						}.bind(this));
-						// 如果未能修改成功, 则回滚 
-						$.when(ajax).done(function() {
-							if(isOk == false) {
-								data.status = oldValue; 
-							}
-						})
-					},
-				},
-				created: function() {
-					this.f5();
-					this.getCustomer();
-					sa.onInputEnter();
-				}
-			})
-		</script>
-	</body>
-</html>

+ 6 - 12
sp-admin/sa-view/tb-partner/tb-costomer-info.html → sp-admin/sa-view/tb-partner/tb-partner-info.html

@@ -31,21 +31,15 @@
 								<sa-info name="企业名称" br>{{m.name}}</sa-info>
 								<sa-info name="联系人" br>{{m.dutyPeople}}</sa-info>
 								<sa-info name="联系电话" br>{{m.phone}}</sa-info>
-								<sa-info name="结算类型" br>
-									<span v-if="m.payType == 1">现结</span>
-									<span v-if="m.payType == 2">月结</span>
-								</sa-info>
-								<!-- <sa-info name="地址" br>{{m.addressStr}}</sa-info> -->
-								<sa-info type="img" name="营业执照" :value="m.businessLicence" br></sa-info>
-								<sa-info type="enum" name="状态" :value="m.status" :jv="{0: '禁用', 1: '启用'}" br></sa-info>
 							</el-col>
 							<el-col span="12">
+								<sa-info name="类型" br>
+									<span v-if="m.type == 1">消杀公司</span>
+									<span v-if="m.type == 2">装卸公司</span>
+								</sa-info>
 								<sa-info name="创建时间" br>{{m.creareTime}}</sa-info>
-								<sa-info type="enum" name="审核状态" :value="m.judgeStatus"
-									:jv="{1: '未审核',2: '审核通过',3: '审核不通过'}" br></sa-info>
-								<sa-info name="审核时间" br>{{m.judgeTime}}</sa-info>
-								<sa-info name="审核意见" br>{{m.judgeContent}}</sa-info>
-								<sa-info name="创建时间" br>{{m.creareTime}}</sa-info>
+								<sa-info type="img" name="营业执照" :value="m.businessLicence" br></sa-info>
+
 							</el-col>
 						</el-row>
 					</el-form>

+ 8 - 28
sp-admin/sa-view/tb-partner/tb-partner-list.html

@@ -25,12 +25,11 @@
 					<sa-item type="text" name="联系电话" v-model="p.phone"></sa-item>
 					<sa-item type="text" name="联系人" v-model="p.dutyPeople"></sa-item>
 					<el-button type="primary" icon="el-icon-search" @click="p.pageNo = 1; f5()">查询</el-button>
-					<br />
-
+					<el-button style="display: inline;" type="primary" icon="el-icon-plus" @click="add()" v-if="currentCustomerId=='1'">新增
+					</el-button>
+					<el-button style="display: inline;" type="info" icon="el-icon-refresh" @click="sa.f5()">重置</el-button>
 				</el-form>
-				<el-button type="primary" icon="el-icon-plus" @click="add()" v-if="currentCustomerId=='1'">新增
-				</el-button>
- 				<el-button type="info" icon="el-icon-refresh" @click="sa.f5()">重置</el-button>
+
 				<!-- ------------- 数据列表 ------------- -->
 				<el-table class="data-table" ref="data-table" :data="dataList">
 					<sa-td type="selection"></sa-td>
@@ -96,11 +95,11 @@
 					currentCustomerId: '1',
 				},
 				methods: {
-					accountFn(data){
+					accountFn(data) {
 						sa.showIframe('账户管理', 'tb-account-manager.html?customerId=' + data.id, '450px', '60%');
 					},
 					judgeFn(data) {
-						
+
 						Object.assign(this.modal, {
 							visible: true,
 							form: {
@@ -110,26 +109,7 @@
 							}
 						})
 					},
-					sureJudge(status) {
-						if (this.modal.form.judgeStatus == 2) {
-							sa.error('已审核通过,无需再审核')
-							return;
-						}
-						let content = "审核通过";
-						if (status == 3) {
-							if (!this.modal.form.judgeContent) {
-								sa.error('请输入审核意见');
-								return;
-							}
-						} else {
-							this.modal.form.judgeContent = content;
-						}
-						this.modal.form.judgeStatus = status;
-						sa.ajax('/TbCostomer/judge', this.modal.form, function(resp) {
-							this.modal.visible = false;
-							this.f5();
-						}.bind(this))
-					},
+				
 					getCustomer() {
 						sa.ajax('/TbCostomer/getCurrentCustomerId', function(resp) {
 							this.currentCustomerId = resp.data;
@@ -148,7 +128,7 @@
 					},
 					// 查看
 					get: function(data) {
-						sa.showIframe('数据详情', 'tb-costomer-info.html?id=' + data.id, '800px', '80%');
+						sa.showIframe('数据详情', 'tb-partner-info.html?id=' + data.id, '800px', '80%');
 					},
 					// 查看 - 根据选中的
 					getBySelect: function(data) {

+ 1 - 1
sp-server/app.pid

@@ -1 +1 @@
-25968
+18200

+ 53 - 8
sp-server/src/main/java/com/pj/api/h5/ApiController.java

@@ -10,6 +10,7 @@ import com.pj.current.satoken.StpUserUtil;
 import com.pj.project.tb_business.TbBusinessService;
 import com.pj.project.tb_business_car.TbBusinessCar;
 import com.pj.project.tb_business_car.TbBusinessCarService;
+import com.pj.project.tb_business_item.TbBusinessItem;
 import com.pj.project.tb_costomer.TbCostomer;
 import com.pj.project.tb_costomer.TbCostomerService;
 import com.pj.project.tb_declare.TbDeclare;
@@ -24,10 +25,7 @@ import org.aspectj.weaver.loadtime.Aj;
 import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.SortedMap;
+import java.util.*;
 
 @RequestMapping(value = "/api")
 @RestController
@@ -46,12 +44,12 @@ public class ApiController {
      * 账号、密码登录
      */
     @RequestMapping("doLogin")
-    AjaxJson doLogin(String key, String password) {
+    AjaxJson doLogin(String key, String password, String openid) {
         // 1、验证参数
         if (NbUtil.isOneNull(key, password)) {
             return AjaxJson.getError("请提供key与password参数");
         }
-        return spAccAdminService.doLogin(key, password);
+        return spAccAdminService.doLogin(key, password, openid);
     }
 
     @PostMapping(value = "register")
@@ -122,13 +120,15 @@ public class ApiController {
     public AjaxJson getAccountInfo() {
         return AjaxJson.getSuccessData(apiService.getAccountInfo(StpUserUtil.getCustomerId()));
     }
+
     @GetMapping(value = "getDiscountInfo")
     public AjaxJson getDiscountInfo() {
         SoMap so = SoMap.getRequestSoMap();
-        so.put("status",1);
-        so.put("sortType",5);
+        so.put("status", 1);
+        so.put("sortType", 5);
         return AjaxJson.getSuccessData(apiService.getDiscountInfo(so));
     }
+
     @PostMapping(value = "addDeclare")
     public AjaxJson addDeclare(@RequestBody TbDeclare tbDeclare) {
         apiService.addDeclare(tbDeclare);
@@ -141,5 +141,50 @@ public class ApiController {
         return AjaxJson.getSuccess();
     }
 
+    @GetMapping("getBusinessItem")
+    public AjaxJson getBusinessItem() {
+        SoMap so = SoMap.getRequestSoMap();
+        return AjaxJson.getSuccessData(apiService.getBusinessItem(so.getString("id")));
+    }
+
+    @PostMapping(value = "pickBusinessItem")
+    public AjaxJson pickBusinessItem() {
+        SoMap so = SoMap.getRequestSoMap();
+        return apiService.pickBusinessItem(so.getString("openid"), so.getLong("id"));
+    }
+
+    @PostMapping(value = "confirmBusinessItem")
+    public AjaxJson confirmBusinessItem() {
+        SoMap so = SoMap.getRequestSoMap();
+        apiService.confirmBusinessItem(so.getLong("id"));
+        return AjaxJson.getSuccess();
+    }
+
+    @GetMapping("getPartnerBusinessItem")
+    public AjaxJson getPartnerBusinessItem() {
+        SoMap so = SoMap.getRequestSoMap();
+        String customerId = StpUserUtil.getCustomerId();
+        if (StrUtil.equals(customerId, UserTypeEnum.PLATFORM_ADMIN.getCustomerId())) {
+            return AjaxJson.getPageData(0L, Collections.emptyList());
+        }
+        so.put("pickCustomerId", StpUserUtil.getCustomerId());
+        so.put("sortType", 9);
+        List<TbBusinessItem> list = apiService.getPartnerBusinessItem(so.startPage());
+        return AjaxJson.getPageData(so.getDataCount(), list);
+    }
 
+    @GetMapping("checkUserType")
+    public AjaxJson checkUserType() {
+        String customerId = StpUserUtil.getCustomerId();
+        int type = 1;
+        if (!StrUtil.equals(customerId, UserTypeEnum.PLATFORM_ADMIN.getCustomerId())) {
+            TbCostomer tbCostomer = tbCostomerService.getById(customerId);
+            if (TbCostomer.CustomerEnum.BUSINESS_TYPE.getType() == tbCostomer.getType()) {
+                type = 2;
+            } else {
+                type = 3;
+            }
+        }
+        return AjaxJson.getSuccessData(type);
+    }
 }

+ 67 - 0
sp-server/src/main/java/com/pj/api/service/ApiService.java

@@ -2,9 +2,14 @@ package com.pj.api.service;
 
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.io.unit.DataUnit;
 import cn.hutool.core.util.RandomUtil;
 import cn.hutool.core.util.StrUtil;
 import com.pj.api.bo.InOutRecordBO;
+import com.pj.api.wx.bo.MsgDataBO;
+import com.pj.api.wx.service.WxService;
+import com.pj.current.config.MyConfig;
+import com.pj.current.config.WxConfig;
 import com.pj.current.satoken.StpUserUtil;
 import com.pj.project.tb_account.TbAccount;
 import com.pj.project.tb_account.TbAccountService;
@@ -12,6 +17,8 @@ import com.pj.project.tb_business.TbBusiness;
 import com.pj.project.tb_business.TbBusinessService;
 import com.pj.project.tb_business_car.TbBusinessCar;
 import com.pj.project.tb_business_car.TbBusinessCarService;
+import com.pj.project.tb_business_item.TbBusinessItem;
+import com.pj.project.tb_business_item.TbBusinessItemService;
 import com.pj.project.tb_costomer.TbCostomer;
 import com.pj.project.tb_costomer.TbCostomerService;
 import com.pj.project.tb_declare.TbDeclare;
@@ -25,7 +32,9 @@ import com.pj.project.tb_district.TbDistrictService;
 import com.pj.project.tb_pass_record.TbPassRecord;
 import com.pj.project.tb_pass_record.TbPassRecordService;
 import com.pj.project4sp.admin.SpAdmin;
+import com.pj.project4sp.admin.SpAdminService;
 import com.pj.utils.cache.RedisUtil;
+import com.pj.utils.sg.AjaxJson;
 import com.pj.utils.so.SoMap;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.context.annotation.Lazy;
@@ -66,6 +75,16 @@ public class ApiService {
     private TbAccountService accountService;
     @Resource
     private TbDiscountService tbDiscountService;
+    @Resource
+    private TbBusinessItemService tbBusinessItemService;
+    @Resource
+    private SpAdminService spAdminService;
+    @Resource
+    private WxService wxService;
+    @Resource
+    private WxConfig wxConfig;
+    @Resource
+    private MyConfig myConfig;
 
     public List<InOutRecordBO> getInOutRecord(SoMap so) {
         List<TbPassRecord> passRecords = tbPassRecordService.getList(so);
@@ -171,4 +190,52 @@ public class ApiService {
     public List<TbDiscount> getDiscountInfo(SoMap so) {
         return tbDiscountService.getList(so);
     }
+
+    public TbBusinessItem getBusinessItem(String id) {
+        return tbBusinessItemService.getById(id);
+    }
+
+    public AjaxJson pickBusinessItem(String openid, long id) {
+        TbBusinessItem tbBusinessItem = tbBusinessItemService.getById(id);
+        if (tbBusinessItem == null) {
+            return AjaxJson.getError("业务项目或已被删除");
+        }
+        SpAdmin spAdmin = spAdminService.findByOpenid(openid);
+        if (spAdmin == null) {
+            return AjaxJson.getError("用户已被删除或解绑");
+        }
+        String customerId = spAdmin.getCustomerId();
+        TbCostomer tbCostomer = tbCostomerService.getById(customerId);
+        tbBusinessItem.setPick(1).setPickTime(new Date()).setPickCustomerId(tbCostomer.getId()).setPickCustomerName(tbCostomer.getName());
+        tbBusinessItemService.updateById(tbBusinessItem);
+        //todo 通知录入人员 已接单
+        String businessId = tbBusinessItem.getBusinessId();
+        TbBusiness tbBusiness = tbBusinessService.getById(businessId);
+        String businessCustomerId = tbBusiness.getCustomerId();
+        List<SpAdmin> spAdminList = spAdminService.findByCustomerId(businessCustomerId);
+        MsgDataBO msgDataBO=new MsgDataBO("您有一条新的接单通知",tbCostomer.getName(), DateUtil.now(),tbBusinessItem.getItemTypeName()+"("+tbBusinessItem.getItemName()+")");
+        spAdminList.stream().filter(admin -> StrUtil.isNotEmpty(admin.getOpenid())).forEach(admin -> {
+            String detailUrl = myConfig.getWebDomain() + "/pages/business-order/business-item?id=" + tbBusinessItem.getId();
+            wxService.sendTemplateMsg(wxConfig.getBusinessPickTemplate(),admin.getOpenid(),msgDataBO,detailUrl);
+        });
+        return AjaxJson.getSuccess();
+    }
+
+    public void confirmBusinessItem(long id) {
+        TbBusinessItem tbBusinessItem = tbBusinessItemService.getById(id);
+        tbBusinessItem.setConfirm(1).setConfirmTime(new Date());
+        tbBusinessItemService.updateById(tbBusinessItem);
+        TbBusiness tbBusiness=tbBusinessService.getById(tbBusinessItem.getBusinessId());
+        //todo 通知作业方
+        List<SpAdmin> spAdminList = spAdminService.findByCustomerId(tbBusinessItem.getPickCustomerId());
+        MsgDataBO msgDataBO=new MsgDataBO("您有一条新的业务确认提醒",tbBusiness.getCustomerName(), DateUtil.now(),tbBusinessItem.getItemTypeName()+"("+tbBusinessItem.getItemName()+")");
+        spAdminList.stream().filter(admin -> StrUtil.isNotEmpty(admin.getOpenid())).forEach(admin -> {
+            String detailUrl = myConfig.getWebDomain() + "/pages/business-order/business-item?id=" + id;
+            wxService.sendTemplateMsg(wxConfig.getBusinessPickTemplate(),admin.getOpenid(),msgDataBO,detailUrl);
+        });
+    }
+
+    public List<TbBusinessItem> getPartnerBusinessItem(SoMap startPage) {
+        return tbBusinessItemService.getList(startPage);
+    }
 }

+ 28 - 0
sp-server/src/main/java/com/pj/api/wx/bo/BaseTemplate.java

@@ -0,0 +1,28 @@
+package com.pj.api.wx.bo;
+
+import lombok.Data;
+
+@Data
+public class BaseTemplate {
+
+    private String touser;
+    private String template_id;
+    private String url;
+    private Object data;
+
+    public BaseTemplate() {
+    }
+
+    public BaseTemplate(String touser, String template_id, Object data) {
+        this.touser = touser;
+        this.template_id = template_id;
+        this.data = data;
+    }
+
+    public BaseTemplate(String touser, String template_id, String url, Object data) {
+        this.touser = touser;
+        this.template_id = template_id;
+        this.url = url;
+        this.data = data;
+    }
+}

+ 25 - 0
sp-server/src/main/java/com/pj/api/wx/bo/Msg.java

@@ -0,0 +1,25 @@
+package com.pj.api.wx.bo;
+
+import lombok.Data;
+
+@Data
+public class Msg {
+    /**
+     * 值
+     */
+    private String value;
+    /**
+     * 颜色
+     */
+    private String color;
+
+    public Msg(String value, String color) {
+        this.value = value;
+        this.color = color;
+    }
+
+    public Msg(String value) {
+        this.value = value;
+        this.color = "#173177";
+    }
+}

+ 50 - 0
sp-server/src/main/java/com/pj/api/wx/bo/MsgDataBO.java

@@ -0,0 +1,50 @@
+package com.pj.api.wx.bo;
+
+import lombok.Data;
+
+@Data
+public class MsgDataBO {
+    private Msg first;
+    private Msg keyword1;
+    private Msg keyword2;
+    private Msg keyword3;
+    private Msg keyword4;
+    private Msg keyword5;
+    private Msg remark;
+
+    public MsgDataBO(String first, String keyword1, String keyword2, String remark) {
+        this.first = new Msg(first);
+        this.keyword1 = new Msg(keyword1);
+        this.keyword2 = new Msg(keyword2);
+        this.remark = new Msg(remark);
+    }
+
+    public MsgDataBO(String first, String keyword1, String keyword2, String keyword3, String remark) {
+        this.first = new Msg(first);
+        this.keyword1 = new Msg(keyword1);
+        this.keyword2 = new Msg(keyword2);
+        this.keyword3 = new Msg(keyword3);
+        this.remark = new Msg(remark);
+    }
+
+    public MsgDataBO(String first, String keyword1, String keyword2, String keyword3, String keyword4, String remark) {
+        this.first = new Msg(first);
+        this.keyword1 = new Msg(keyword1);
+        this.keyword2 = new Msg(keyword2);
+        this.keyword3 = new Msg(keyword3);
+        this.keyword4 = new Msg(keyword4);
+        this.remark = new Msg(remark);
+    }
+
+    public MsgDataBO(String first, String keyword1, String keyword2, String keyword3, String keyword4, String keyword5, String remark) {
+        this.first = new Msg(first);
+        this.keyword1 = new Msg(keyword1);
+        this.keyword2 = new Msg(keyword2);
+        this.keyword3 = new Msg(keyword3);
+        this.keyword4 = new Msg(keyword4);
+        this.keyword5 = new Msg(keyword5);
+        this.remark = new Msg(remark);
+
+    }
+
+}

+ 21 - 2
sp-server/src/main/java/com/pj/api/wx/service/WxService.java

@@ -11,6 +11,7 @@ import cn.hutool.crypto.SecureUtil;
 import cn.hutool.http.HttpUtil;
 import cn.hutool.json.JSONObject;
 import cn.hutool.json.JSONUtil;
+import com.alibaba.fastjson.JSON;
 import com.pj.api.wx.WxUtils;
 import com.pj.api.wx.bo.*;
 import com.pj.api.wx.vo.PrePayVO;
@@ -31,7 +32,6 @@ import com.pj.project.tb_fee_statistics.TbFeeStatisticsService;
 import com.pj.project.tb_pay_record.TbPayRecord;
 import com.pj.project.tb_pay_record.TbPayRecordService;
 import com.pj.utils.cache.RedisUtil;
-import lombok.experimental.Accessors;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.scheduling.annotation.Async;
@@ -43,7 +43,6 @@ import javax.servlet.http.HttpServletRequest;
 import java.math.BigDecimal;
 import java.nio.charset.Charset;
 import java.util.*;
-import java.util.stream.Collectors;
 
 @Service
 @Transactional
@@ -257,4 +256,24 @@ public class WxService {
         params.put("appId", wxConfig.getAppId());
         return params;
     }
+
+    @Async
+    public void sendTemplateMsg(String templateId, String openid, MsgDataBO data) {
+        String accessToken = RedisUtil.get(wxConfig.getAccessTokenKey());
+        BaseTemplate baseTemplate = new BaseTemplate(openid, templateId, data);
+        String json = JSON.toJSONString(baseTemplate);
+        String url = wxConfig.getSendMsgUrl().replace("ACCESS_TOKEN", accessToken);
+        String resp = HttpUtil.post(url, json);
+        log.info("send wx msg{},{},{};return :{}", templateId, openid, JSONUtil.toJsonStr(data), resp);
+    }
+
+    @Async
+    public void sendTemplateMsg(String templateId, String openid, MsgDataBO data,String detailUrl) {
+        String accessToken = RedisUtil.get(wxConfig.getAccessTokenKey());
+        BaseTemplate baseTemplate = new BaseTemplate(openid, templateId, detailUrl,data);
+        String json = JSON.toJSONString(baseTemplate);
+        String url = wxConfig.getSendMsgUrl().replace("ACCESS_TOKEN", accessToken);
+        String resp = HttpUtil.post(url, json);
+        log.info("send wx msg{},{},{};return :{}", templateId, openid, JSONUtil.toJsonStr(data), resp);
+    }
 }

+ 1 - 1
sp-server/src/main/java/com/pj/constants/RoleEnum.java

@@ -26,7 +26,7 @@ public enum RoleEnum {
             Arrays.asList(AuthConst.ADMIN_LIST,TbCostomer.PERMISSION_CODE,TbCostomer.PERMISSION_INFO,TbBusiness.PERMISSION_CODE,TbBusiness.PERMISSION_LIST,TbBusiness.PERMISSION_PAY)),
     ADMIN_ROLE("admin","管理员", Collections.emptyList()),
     SUPER_ROLE("super","超级管理员", Collections.emptyList()),
-    COMMON_ROLE_PER("common","共同",Arrays.asList(TbNotices.PERMISSION_CODE,TbNotices.PERMISSION_LIST, TbBusinessCar.PERMISSION_CODE, TbBusinessCar.PERMISSION_LIST))
+    COMMON_ROLE_PER("common","共同",Arrays.asList(TbNotices.PERMISSION_CODE,TbNotices.PERMISSION_LIST, TbBusinessCar.PERMISSION_CODE, TbBusinessCar.PERMISSION_LIST)),
     ;
     private String type;
     private String name;

+ 24 - 0
sp-server/src/main/java/com/pj/current/config/WxConfig.java

@@ -21,4 +21,28 @@ public class WxConfig {
     private String   authLoginUrl;
     private String jsApiTokenUrl;
     private String openidUrl;
+    private String sendMsgUrl;
+    /**
+     * {{first.DATA}}
+     * 作业类型:{{keyword1.DATA}}
+     * 作业名称:{{keyword2.DATA}}
+     * 所属项目:{{keyword3.DATA}}
+     * 提交日期:{{keyword4.DATA}}
+     * {{remark.DATA}}
+     */
+    private String businessNoticeTemplate;
+    /**
+     * {{first.DATA}}
+     * 接单人:{{keyword1.DATA}}
+     * 接单时间:{{keyword2.DATA}}
+     * {{remark.DATA}}
+     */
+    private String businessPickTemplate;
+    /**
+     * {{first.DATA}}
+     * 确认人:{{keyword1.DATA}}
+     * 时间:{{keyword2.DATA}}
+     * {{remark.DATA}}
+     */
+    private String businessConfirmTemplate;
 }

+ 25 - 10
sp-server/src/main/java/com/pj/project/tb_business/TbBusinessService.java

@@ -19,9 +19,13 @@ import cn.hutool.json.JSONUtil;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.pj.api.wx.bo.MsgDataBO;
+import com.pj.api.wx.service.WxService;
 import com.pj.constants.UserTypeEnum;
 import com.pj.current.config.CarConfig;
+import com.pj.current.config.MyConfig;
 import com.pj.current.config.PartConfig;
+import com.pj.current.config.WxConfig;
 import com.pj.current.satoken.StpUserUtil;
 import com.pj.project.tb_business_car.TbBusinessCar;
 import com.pj.project.tb_business_car.TbBusinessCarService;
@@ -112,7 +116,12 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
     @Lazy
     TbDeclareService tbDeclareService;
     @Resource
-    TbGoodsService tbGoodsService;
+    WxConfig wxConfig;
+    @Resource
+    @Lazy
+    WxService wxService;
+    @Resource
+    MyConfig myConfig;
 
 
     public TbBusiness checkCarNo(String carNo) {
@@ -126,7 +135,6 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
      * 增
      */
     public AjaxJson addOrUpdate(TbBusiness t) {
-
         if (StrUtil.isNotEmpty(t.getId()) && StrUtil.isNotEmpty(t.getDeclareNo())) {
             TbBusiness db = this.getById(t.getId());
             if (!StrUtil.equals(db.getDeclareNo(), t.getDeclareNo())) {
@@ -167,18 +175,26 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
         tbBusinessItemService.removeByBusinessId(t.getId());
         BigDecimal price = new BigDecimal(0);
         List<TbBusinessItem> items = JSONUtil.toList(t.getItemJson(), TbBusinessItem.class);
-        List<String> typeNames = new ArrayList<>();
         for (TbBusinessItem item : items) {
             Double num = NumberUtil.parseDouble(item.getNum());
             TbItem tbItem = tbItemService.getById(item.getItemId());
+            String typeId = tbItem.getTypeId();
             price = price.add(NumberUtil.mul(num, tbItem.getPrice()));
-            TbItemType tbItemType = tbItemTypeService.getById(tbItem.getTypeId());
-            String type = tbItemType.getName();
-            typeNames.add(type);
+            TbItemType tbItemType = tbItemTypeService.getById(typeId);
             item.setBusinessId(t.getId()).setItemCode(tbItem.getItemCode())
                     .setItemName(tbItem.getItemName()).setItemPrice(tbItem.getPrice())
-                    .setItemTypeId(tbItem.getTypeId()).setItemTypeName(tbItemType.getName())
-                    .setUnit(tbItem.getUnit()).setTotal(NumberUtil.mul(num, tbItem.getPrice()));
+                    .setItemTypeId(typeId).setItemTypeName(tbItemType.getName())
+                    .setUnit(tbItem.getUnit()).setTotal(NumberUtil.mul(num, tbItem.getPrice())).setCreateTime(new Date());
+            tbBusinessItemService.save(item);
+            Integer businessType = tbItemType.getBusinessType();
+            if (businessType != null && businessType != 0) {
+                MsgDataBO msgDataBO=new MsgDataBO("您收到一条新的作业提醒",tbItemType.getName(),tbItem.getItemName(),t.getGoodsName(),DateUtil.today(),"点击进入详情进行接单");
+                List<String> openidList = tbCostomerService.findByBusinessTypeOpenid(businessType);
+                openidList.forEach(openid-> {
+                    String detailUrl = myConfig.getWebDomain() + "/pages/business-item/item-detail?itemId=" + item.getId()+"&openid="+openid;
+                    wxService.sendTemplateMsg(wxConfig.getBusinessNoticeTemplate(),openid,msgDataBO,detailUrl);
+                });
+            }
         }
         List<TbBusinessCar> carList = JSONUtil.toList(t.getCarJson(), TbBusinessCar.class);
         String chinaCarNo = carList.stream().map(TbBusinessCar::getCarNo).collect(Collectors.joining("、"));
@@ -214,7 +230,6 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
                 .setChinaPartMoney(initCarPartMoney.multiply(new BigDecimal(carList.size() - 1)))
                 .setPartMoney(initCarPartMoney);
         this.saveOrUpdate(t);
-        tbBusinessItemService.saveBatch(items);
         if (StrUtil.isNotEmpty(t.getDeclareNo())) {
             TbDeclare tbDeclare = tbDeclareService.findByDeclareNo(t.getDeclareNo());
             tbDeclare.setBusinessId(t.getId());
@@ -452,7 +467,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
             carMap.put("price", partMoney);
             carMap.put("id", tbBusinessCar.getId());
             carMap.put("carNo", tbBusinessCar.getCarNo());
-            carMap.put("pay",tbBusinessCar.getPay());
+            carMap.put("pay", tbBusinessCar.getPay());
             carsList.add(carMap);
         }
         result.put("carList", carsList);

+ 7 - 0
sp-server/src/main/java/com/pj/project/tb_business_item/TbBusinessItem.java

@@ -92,6 +92,13 @@ public class TbBusinessItem extends Model<TbBusinessItem> implements Serializabl
 
 	private Integer payStatus;
 	private Date payTime;
+	private Date createTime;
+	private Integer pick;
+	private Date pickTime;
+	private Integer confirm;
+	private Date confirmTime;
+	private String pickCustomerId;
+	private String pickCustomerName;
 
 
 

+ 42 - 33
sp-server/src/main/java/com/pj/project/tb_business_item/TbBusinessItemController.java

@@ -2,6 +2,8 @@ package com.pj.project.tb_business_item;
 
 import java.util.List;
 
+import cn.hutool.core.util.StrUtil;
+import com.pj.constants.UserTypeEnum;
 import com.pj.project.tb_business.TbBusiness;
 import com.pj.utils.so.SoMap;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -17,43 +19,50 @@ import cn.dev33.satoken.annotation.SaCheckPermission;
 
 /**
  * Controller: tb_business_item -- 业务作业项
- * @author qzy 
+ *
+ * @author qzy
  */
 @RestController
 @RequestMapping("/TbBusinessItem/")
 public class TbBusinessItemController {
 
-	/** 底层 Service 对象 */
-	@Autowired
-	TbBusinessItemService tbBusinessItemService;
-
-	/** 改 */  
-	@RequestMapping("update")
-	public AjaxJson update(TbBusinessItem t){
-		tbBusinessItemService.updateById(t);
-		return AjaxJson.getSuccess();
-	}
-
-	/** 查 - 根据id */  
-	@RequestMapping("getById")
-	public AjaxJson getById(String id){
-		TbBusinessItem t = tbBusinessItemService.getById(id);
-		return AjaxJson.getSuccessData(t);
-	}
-
-	/** 查集合 - 根据条件(参数为空时代表忽略指定条件) */  
-	@RequestMapping("getList")
-	public AjaxJson getList() { 
-		SoMap so = SoMap.getRequestSoMap();
-		List<TbBusinessItem> list = tbBusinessItemService.getList(so.startPage());
-		return AjaxJson.getPageData(so.getDataCount(), list);
-	}
-	
-
-	
-	
-	
-	
-	
+    /**
+     * 底层 Service 对象
+     */
+    @Autowired
+    TbBusinessItemService tbBusinessItemService;
+
+    /**
+     * 改
+     */
+    @RequestMapping("update")
+    public AjaxJson update(TbBusinessItem t) {
+        tbBusinessItemService.updateById(t);
+        return AjaxJson.getSuccess();
+    }
+
+    /**
+     * 查 - 根据id
+     */
+    @RequestMapping("getById")
+    public AjaxJson getById(String id) {
+        TbBusinessItem t = tbBusinessItemService.getById(id);
+        return AjaxJson.getSuccessData(t);
+    }
+
+    /**
+     * 查集合 - 根据条件(参数为空时代表忽略指定条件)
+     */
+    @RequestMapping("getList")
+    public AjaxJson getList() {
+        SoMap so = SoMap.getRequestSoMap();
+        String customerId = StpUserUtil.getCustomerId();
+        if (!StrUtil.equals(customerId, UserTypeEnum.PLATFORM_ADMIN.getCustomerId())) {
+            so.put("pickCustomerId", customerId);
+        }
+        List<TbBusinessItem> list = tbBusinessItemService.getList(so.startPage());
+        return AjaxJson.getPageData(so.getDataCount(), list);
+    }
+
 
 }

+ 3 - 1
sp-server/src/main/java/com/pj/project/tb_business_item/TbBusinessItemMapper.xml

@@ -59,9 +59,10 @@
 		<where>
 			<if test=' this.has("id") '> and id = #{id} </if>
 			<if test=' this.has("businessId") '> and business_id = #{businessId} </if>
+			<if test=' this.has("pickCustomerId") '> and pick_customer_id = #{pickCustomerId} </if>
 			<if test=' this.has("itemCode") '> and item_code = #{itemCode} </if>
 			<if test=' this.has("itemPrice") '> and item_price = #{itemPrice} </if>
-			<if test=' this.has("itemName") '> and item_name = #{itemName} </if>
+			<if test=' this.has("itemName") '> and item_name like concat('%',#{itemName},'%') </if>
 			<if test=' this.has("status") '> and status = #{status} </if>
 			<if test=' this.has("operateTime") '> and operate_time = #{operateTime} </if>
 			<if test=' this.has("operaror") '> and operaror = #{operaror} </if>
@@ -76,6 +77,7 @@
 			<when test='sortType == 6'> status desc </when>
 			<when test='sortType == 7'> operate_time desc </when>
 			<when test='sortType == 8'> operaror desc </when>
+			<when test='sortType == 9'> pick_time desc </when>
 			<otherwise> id desc </otherwise>
 		</choose>
 	</select>

+ 3 - 1
sp-server/src/main/java/com/pj/project/tb_business_item/TbBusinessItemService.java

@@ -42,7 +42,7 @@ public class TbBusinessItemService extends ServiceImpl<TbBusinessItemMapper,TbBu
 	}
 
 	/** 查集合 - 根据条件(参数为空时代表忽略指定条件) */  
-	List<TbBusinessItem> getList(SoMap so) {
+	public List<TbBusinessItem> getList(SoMap so) {
 		return tbBusinessItemMapper.getList(so);	
 	}
 
@@ -56,6 +56,8 @@ public class TbBusinessItemService extends ServiceImpl<TbBusinessItemMapper,TbBu
     public List<TbBusinessItem> findByBusinessId(String businessId) {
 		QueryWrapper<TbBusinessItem>ew=new QueryWrapper<>();
 		ew.eq("business_id",businessId);
+		ew.orderByDesc("pick");
+		ew.orderByAsc("confirm");
 		return list(ew);
     }
 

+ 1 - 1
sp-server/src/main/java/com/pj/project/tb_costomer/TbCostomer.java

@@ -105,7 +105,7 @@ public class TbCostomer extends Model<TbCostomer> implements Serializable {
 	/**
 	 * 类型0、理货员;1、消杀;2、装卸
 	 */
-	private int type;
+	private Integer type;
 
 	@Getter
 	@AllArgsConstructor

+ 0 - 1
sp-server/src/main/java/com/pj/project/tb_costomer/TbCostomerController.java

@@ -111,7 +111,6 @@ public class TbCostomerController {
 
 
 	@RequestMapping("getCurrentCustomerId")
-	@SaCheckPermission(TbCostomer.PERMISSION_CODE)
 	public AjaxJson getCurrentCustomer(){
 		String id=StpUserUtil.getCustomerId();
 		return AjaxJson.getSuccessData(id);

+ 2 - 0
sp-server/src/main/java/com/pj/project/tb_costomer/TbCostomerMapper.java

@@ -6,6 +6,7 @@ import org.apache.ibatis.annotations.Mapper;
 
 import com.pj.utils.so.*;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
 
 /**
@@ -53,4 +54,5 @@ public interface TbCostomerMapper extends BaseMapper <TbCostomer> {
 	List<TbCostomer> getList(SoMap so);
 
 
+    List<String> findByBusinessTypeOpenid(@Param("businessType") Integer businessType);
 }

+ 71 - 75
sp-server/src/main/java/com/pj/project/tb_costomer/TbCostomerMapper.xml

@@ -2,21 +2,21 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.pj.project.tb_costomer.TbCostomerMapper">
 
-	<!-- 增 [G] -->
-	<insert id="add">
+    <!-- 增 [G] -->
+    <insert id="add">
 		insert into 
 		tb_costomer (id, name, phone, duty_people, address_ids, address_str, business_licence, status, creare_time, judge_status, judge_time, judge_content) 
 		values (#{id}, #{name}, #{phone}, #{dutyPeople}, #{addressIds}, #{addressStr}, #{businessLicence}, #{status}, #{creareTime}, #{judgeStatus}, #{judgeTime}, #{judgeContent}) 
 	</insert>
 
-	<!-- 删 -->
-	<delete id="delete">
+    <!-- 删 -->
+    <delete id="delete">
 		delete from tb_costomer 
 		where id = #{id}
 	</delete>
 
-	<!-- 改 [G] -->
-	<update id="update">
+    <!-- 改 [G] -->
+    <update id="update">
 		update tb_costomer set
 		id = #{id}, 
 		name = #{name}, 
@@ -34,82 +34,78 @@
 	</update>
 
 
-	<!-- ================================== 查询相关 ================================== -->
+    <!-- ================================== 查询相关 ================================== -->
 
-	
-	<!-- 通用映射:手动模式 -->
-	<resultMap id="model" type="com.pj.project.tb_costomer.TbCostomer">
-		<result property="id" column="id" />
-		<result property="name" column="name" />
-		<result property="phone" column="phone" />
-		<result property="dutyPeople" column="duty_people" />
-		<result property="addressIds" column="address_ids" />
-		<result property="addressStr" column="address_str" />
-		<result property="businessLicence" column="business_licence" />
-		<result property="status" column="status" />
-		<result property="creareTime" column="creare_time" />
-		<result property="judgeStatus" column="judge_status" />
-		<result property="judgeTime" column="judge_time" />
-		<result property="judgeContent" column="judge_content" />
-	</resultMap>
-	
-	<!-- 公共查询sql片段 -->
-	<sql id="select_sql">
+
+    <!-- 通用映射:手动模式 -->
+    <resultMap id="model" type="com.pj.project.tb_costomer.TbCostomer">
+        <result property="id" column="id"/>
+        <result property="name" column="name"/>
+        <result property="phone" column="phone"/>
+        <result property="dutyPeople" column="duty_people"/>
+        <result property="addressIds" column="address_ids"/>
+        <result property="addressStr" column="address_str"/>
+        <result property="businessLicence" column="business_licence"/>
+        <result property="status" column="status"/>
+        <result property="creareTime" column="creare_time"/>
+        <result property="judgeStatus" column="judge_status"/>
+        <result property="judgeTime" column="judge_time"/>
+        <result property="judgeContent" column="judge_content"/>
+    </resultMap>
+
+    <!-- 公共查询sql片段 -->
+    <sql id="select_sql">
 		select 	*
 		from tb_costomer
 	</sql>
-	
-	<!-- 查 - 根据id -->
-	<select id="getById" resultMap="model">
-		<include refid="select_sql"></include>
-		where id = #{id}
-	</select>
-	
-	<!-- 查集合 - 根据条件(参数为空时代表忽略指定条件) [G] -->
-	<select id="getList" resultMap="model">
-		<include refid="select_sql"></include>
-		<where>
-			<if test=' this.has("id") '> and id = #{id} </if>
-			<if test=' this.has("name") '> and name like concat('%',#{name},'%')  </if>
-			<if test=' this.has("phone") '> and phone like concat('%',#{phone},'%')  </if>
-			<if test=' this.has("dutyPeople") '> and duty_people  like concat('%',#{dutyPeople},'%') </if>
-			<if test=' this.has("addressIds") '> and address_ids = #{addressIds} </if>
-			<if test=' this.has("addressStr") '> and address_str = #{addressStr} </if>
-			<if test=' this.has("status") '> and status = #{status} </if>
-			<if test=' this.has("creareTime") '> and creare_time = #{creareTime} </if>
-			<if test=' this.has("judgeStatus") '> and judge_status = #{judgeStatus} </if>
-			<if test=' this.has("judgeTime") '> and judge_time = #{judgeTime} </if>
-			<if test=' this.has("type") '> and type = #{type} </if>
-			<if test=' this.has("partner") '> and type != 0 </if>
-			<if test=' this.has("judgeContent") '> and judge_content = #{judgeContent} </if>
+
+    <!-- 查 - 根据id -->
+    <select id="getById" resultMap="model">
+        <include refid="select_sql"></include>
+        where id = #{id}
+    </select>
+
+    <!-- 查集合 - 根据条件(参数为空时代表忽略指定条件) [G] -->
+    <select id="getList" resultMap="model">
+        <include refid="select_sql"></include>
+        <where>
+            <if test=' this.has("id") '>and id = #{id}</if>
+            <if test=' this.has("name") '>and name like concat('%',#{name},'%')</if>
+            <if test=' this.has("phone") '>and phone like concat('%',#{phone},'%')</if>
+            <if test=' this.has("dutyPeople") '>and duty_people like concat('%',#{dutyPeople},'%')</if>
+            <if test=' this.has("addressIds") '>and address_ids = #{addressIds}</if>
+            <if test=' this.has("addressStr") '>and address_str = #{addressStr}</if>
+            <if test=' this.has("status") '>and status = #{status}</if>
+            <if test=' this.has("creareTime") '>and creare_time = #{creareTime}</if>
+            <if test=' this.has("judgeStatus") '>and judge_status = #{judgeStatus}</if>
+            <if test=' this.has("judgeTime") '>and judge_time = #{judgeTime}</if>
+            <if test=' this.has("type") '>and type = #{type}</if>
+            <if test=' this.has("partner") '>and type != 0</if>
+            <if test=' this.has("judgeContent") '>and judge_content = #{judgeContent}</if>
             <if test=' this.has("current") '>
                 <if test=' current != 0 '>and judge_status = #{current}</if>
             </if>
-		</where>
-		order by
-		<choose>
-			<when test='sortType == 1'> id desc </when>
-			<when test='sortType == 2'> name desc </when>
-			<when test='sortType == 3'> phone desc </when>
-			<when test='sortType == 4'> duty_people desc </when>
-			<when test='sortType == 5'> address_ids desc </when>
-			<when test='sortType == 6'> address_str desc </when>
-			<when test='sortType == 7'> status desc </when>
-			<when test='sortType == 8'> creare_time desc </when>
-			<when test='sortType == 9'> judge_status desc </when>
-			<when test='sortType == 10'> judge_time desc </when>
-			<when test='sortType == 11'> judge_content desc </when>
-			<otherwise> id desc </otherwise>
-		</choose>
+        </where>
+        order by
+        <choose>
+            <when test='sortType == 1'>id desc</when>
+            <when test='sortType == 2'>name desc</when>
+            <when test='sortType == 3'>phone desc</when>
+            <when test='sortType == 4'>duty_people desc</when>
+            <when test='sortType == 5'>address_ids desc</when>
+            <when test='sortType == 6'>address_str desc</when>
+            <when test='sortType == 7'>status desc</when>
+            <when test='sortType == 8'>creare_time desc</when>
+            <when test='sortType == 9'>judge_status desc</when>
+            <when test='sortType == 10'>judge_time desc</when>
+            <when test='sortType == 11'>judge_content desc</when>
+            <otherwise>id desc</otherwise>
+        </choose>
+    </select>
+    <select id="findByBusinessTypeOpenid" resultType="java.lang.String">
+		SELECT b.openid from tb_costomer a LEFT JOIN sp_admin b on a.id=b.customer_id
+        WHERE a.type=#{businessType} and b.openid !='' and b.openid is not null
 	</select>
-	
-	
-	
-	
-	
-	
-	
-	
-	
+
 
 </mapper>

+ 5 - 0
sp-server/src/main/java/com/pj/project/tb_costomer/TbCostomerService.java

@@ -175,4 +175,9 @@ public class TbCostomerService extends ServiceImpl<TbCostomerMapper, TbCostomer>
         spAdminService.addWhenRegister(spAdmin);
         spAdminMapper.updateCustomerAdmin(costomer.getId(), 2);
     }
+
+    public List<String> findByBusinessTypeOpenid(Integer businessType) {
+        return  tbCostomerMapper.findByBusinessTypeOpenid(businessType);
+
+    }
 }

+ 4 - 0
sp-server/src/main/java/com/pj/project/tb_item_type/TbItemType.java

@@ -55,6 +55,10 @@ public class TbItemType extends Model<TbItemType> implements Serializable {
 	private int need;
 	private String code;
 	private Integer inc=0;
+	/**
+	 * 业务类型1,消杀;2装卸;0默认
+	 */
+	private Integer businessType=0;
 
 	@TableField(exist = false)
 	private List<TbItem>items=new ArrayList<>();

+ 2 - 3
sp-server/src/main/java/com/pj/project/tb_item_type/TbItemTypeController.java

@@ -55,10 +55,9 @@ public class TbItemTypeController {
 	
 	/** 改 */  
 	@RequestMapping("update")
-	@SaCheckPermission(TbItemType.PERMISSION_CODE)
 	public AjaxJson update(TbItemType t){
-		int line = tbItemTypeService.update(t);
-		return AjaxJson.getByLine(line);
+		tbItemTypeService.updateById(t);
+		return AjaxJson.getSuccess();
 	}
 
 	/** 查 - 根据id */  

+ 3 - 1
sp-server/src/main/java/com/pj/project4sp/admin/SpAdmin.java

@@ -21,7 +21,9 @@ public class SpAdmin implements Serializable  {
 	/** id,--主键、自增 */
 	private Long id;
 	private String customerId;
-	
+
+	private String openid;
+
 	/** admin名称 */
 	private String name;
 	

+ 10 - 0
sp-server/src/main/java/com/pj/project4sp/admin/SpAdminController.java

@@ -129,6 +129,16 @@ public class SpAdminController {
         return AjaxJson.getSuccess();
     }
 
+    @RequestMapping("addPartnerAdmin")
+    AjaxJson addPartnerAdmin(SpAdmin spAdmin){
+      SpAdmin db=  spAdminMapper.getByName(spAdmin.getName());
+      if(db!=null){
+          return AjaxJson.getError("登录名已被占用");
+      }
+        spAdminService.add(spAdmin);
+        return AjaxJson.getSuccess();
+    }
+
     @RequestMapping("setRole")
     public AjaxJson setRole() {
         StpUtil.checkPermission(AuthConst.ADMIN_LIST);

+ 6 - 0
sp-server/src/main/java/com/pj/project4sp/admin/SpAdminMapper.java

@@ -72,4 +72,10 @@ public interface SpAdminMapper {
 	void updateCustomerAdmin(@Param("customerId")String customerId, @Param("status")int status);
 
     List<SpAdmin> getByCostomerId(@Param("customerId")String customerId);
+
+    SpAdmin findByOpenid(@Param("openid")String openid);
+
+    List<SpAdmin> findByCustomerId(@Param("customerId")String customerId);
+
+	void updateOpenid(SpAdmin admin);
 }

+ 80 - 70
sp-server/src/main/java/com/pj/project4sp/admin/SpAdminMapper.xml

@@ -3,88 +3,91 @@
 <mapper namespace="com.pj.project4sp.admin.SpAdminMapper">
 
 
-	<!-- 增 -->
-	<insert id="add">
+    <!-- 增 -->
+    <insert id="add">
 		insert into
 		sp_admin(name, customer_id,avatar, phone, role_id, create_by_aid, create_time)
 		values (#{name},#{customerId}, #{avatar}, #{phone}, #{roleId}, #{createByAid}, now())
 	</insert>
-	<update id="setRole">
+    <update id="setRole">
 		update sp_admin set role_id=#{roleId} where id=#{id}
 	</update>
-	<update id="updateCustomerAdmin">
+    <update id="updateCustomerAdmin">
 		update sp_admin set status=#{status} where customer_id=#{customerId}
 	</update>
+    <update id="updateOpenid">
+			update sp_admin set openid=#{openid} where id=#{id}
+	</update>
 
 
-	<!-- 删 -->
-	<delete id="delete">
+    <!-- 删 -->
+    <delete id="delete">
 		delete from sp_admin where id = #{id} 
 	</delete>
 
 
-	<!-- 改 -->
-	<delete id="update">
+    <!-- 改 -->
+    <delete id="update">
 		update sp_admin set 
 		name = #{name} 
 		where id = #{id} 
 	</delete>
-	<delete id="removeByCustomerId">
+    <delete id="removeByCustomerId">
 		delete  from sp_admin where customer_id=#{customerId}
 	</delete>
 
-	<!-- 自己改自己 -->
-	<!-- <delete id="updateBy">
-		update sp_admin set 
-		name = #{name} 
-		where id = #{id} 
-	</delete> -->
-
-	<!-- =================== 查询相关 =================== -->
-
-	<!-- 通用映射 -->
-	<resultMap id="model" type="com.pj.project4sp.admin.SpAdmin">
-		<result property="id" column="id" />
-		<result property="name" column="name" />
-		<result property="avatar" column="avatar" />
-		<result property="password" column="password" />
-		<result property="pw" column="pw" />
-		<result property="phone" column="phone" />
-		<result property="roleId" column="role_id" />
-		<result property="status" column="status" />
-		<result property="createByAid" column="create_by_aid" />
-		<result property="createTime" column="create_time" />
-		<result property="loginTime" column="login_time" />
-		<result property="loginIp" column="login_ip" />
-		<result property="loginCount" column="login_count" />
-		<result property="roleName" column="role_name" />
-	</resultMap>
-	
-	<!-- 查询sql -->
-	<sql id="select_sql">
+    <!-- 自己改自己 -->
+    <!-- <delete id="updateBy">
+        update sp_admin set
+        name = #{name}
+        where id = #{id}
+    </delete> -->
+
+    <!-- =================== 查询相关 =================== -->
+
+    <!-- 通用映射 -->
+    <resultMap id="model" type="com.pj.project4sp.admin.SpAdmin">
+        <result property="id" column="id"/>
+        <result property="name" column="name"/>
+        <result property="avatar" column="avatar"/>
+        <result property="password" column="password"/>
+        <result property="pw" column="pw"/>
+        <result property="phone" column="phone"/>
+        <result property="roleId" column="role_id"/>
+        <result property="status" column="status"/>
+        <result property="createByAid" column="create_by_aid"/>
+        <result property="createTime" column="create_time"/>
+        <result property="loginTime" column="login_time"/>
+        <result property="loginIp" column="login_ip"/>
+        <result property="loginCount" column="login_count"/>
+        <result property="roleName" column="role_name"/>
+    </resultMap>
+
+    <!-- 查询sql -->
+    <sql id="select_sql">
 		select *,
 		(select name from sp_role where id = sp_admin.role_id) as role_name 
 		from sp_admin 
 	</sql>
 
 
-	<!-- 查询,根据id -->
-	<select id="getById" resultMap="model">
-		<include refid="select_sql"></include>
-		where id = #{id}
-	</select>
+    <!-- 查询,根据id -->
+    <select id="getById" resultMap="model">
+        <include refid="select_sql"></include>
+        where id = #{id}
+    </select>
 
-	<!-- 查询,根据名称 -->
-	<select id="getByName" resultMap="model">
-		<include refid="select_sql"></include>
-		where name = #{name}
-	</select>
+    <!-- 查询,根据名称 -->
+    <select id="getByName" resultMap="model">
+        <include refid="select_sql"></include>
+        where name = #{name}
+    </select>
 
-	<!-- 查询,根据名称 -->
-	<select id="getByPhone" resultMap="model">
-		<include refid="select_sql"></include>
-		where phone = #{phone}
-	</select>
+    <!-- 查询,根据名称 -->
+    <select id="getByPhone" resultMap="model">
+        <include refid="select_sql"></include>
+        where phone = #{phone}
+    </select>
 
     <!-- 查询,根据customerId -->
     <select id="getByCostomerId" resultMap="model">
@@ -93,23 +96,30 @@
     </select>
 
 
-	<!-- 查询 -->
-	<select id="getList" resultMap="model">
-		<include refid="select_sql"></include>
-		where customer_id=#{customerId}
-		<if test=' this.has("id")  '>and id = #{id} </if>
-		<if test=' this.has("name")  '>and name like concat('%', #{name}, '%')  </if>
-		<if test=' this.has("roleId")  '>and role_id = #{roleId} </if>
-		order by 
-		<choose>
-			<when test='sort_type == 0'>id desc</when> 
-			<when test='sort_type == 1'>id asc</when> 
-			<when test='sort_type == 2'>login_time desc</when> 
-			<when test='sort_type == 3'>login_count desc</when> 
-		 	<otherwise>id desc</otherwise>
-		 </choose>
-	</select>
-	
+    <!-- 查询 -->
+    <select id="getList" resultMap="model">
+        <include refid="select_sql"></include>
+        where customer_id=#{customerId}
+        <if test=' this.has("id")  '>and id = #{id}</if>
+        <if test=' this.has("name")  '>and name like concat('%', #{name}, '%')</if>
+        <if test=' this.has("roleId")  '>and role_id = #{roleId}</if>
+        order by
+        <choose>
+            <when test='sort_type == 0'>id desc</when>
+            <when test='sort_type == 1'>id asc</when>
+            <when test='sort_type == 2'>login_time desc</when>
+            <when test='sort_type == 3'>login_count desc</when>
+            <otherwise>id desc</otherwise>
+        </choose>
+    </select>
+    <select id="findByOpenid" resultType="com.pj.project4sp.admin.SpAdmin">
+        <include refid="select_sql"></include>
+        where openid = #{openid}
+    </select>
+    <select id="findByCustomerId" resultType="com.pj.project4sp.admin.SpAdmin">
+        <include refid="select_sql"></include>
+        where customer_id = #{customerId}
+    </select>
 
 
 </mapper>

+ 11 - 4
sp-server/src/main/java/com/pj/project4sp/admin/SpAdminService.java

@@ -10,6 +10,8 @@ import com.pj.project4sp.admin4password.SpAdminPasswordService;
 
 import cn.dev33.satoken.stp.StpUtil;
 
+import java.util.List;
+
 /**
  * Service: admin管理员
  * @author kong
@@ -69,8 +71,13 @@ public class SpAdminService {
         // 返回主键
         return id;
     }
-	
-	
-	
-	
+
+
+	public SpAdmin findByOpenid(String openid) {
+		return spAdminMapper.findByOpenid(openid);
+	}
+
+	public List<SpAdmin> findByCustomerId(String businessCustomerId) {
+		return spAdminMapper.findByCustomerId(businessCustomerId);
+	}
 }

+ 104 - 91
sp-server/src/main/java/com/pj/project4sp/admin4login/SpAccAdminService.java

@@ -3,6 +3,7 @@ package com.pj.project4sp.admin4login;
 
 import java.util.Date;
 
+import cn.hutool.core.util.StrUtil;
 import com.pj.current.satoken.StpUserUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -24,115 +25,127 @@ import cn.dev33.satoken.stp.StpUtil;
 
 /**
  * service:admin账号相关
- * @author kong
  *
+ * @author kong
  */
 @Service
 public class SpAccAdminService {
 
-	
-
-	@Autowired
-	SpAccAdminMapper spAccAdminMapper;
-
-	@Autowired
-	SpAdminMapper spAdminMapper;
-	
-	@Autowired
-	SpRolePermissionService spRolePermissionService;
-	
-	
-	/**
-	  * 登录 
-	 * @param name 店铺名称
-	 * @param password 店铺密码 
-	 * @return
-	 */
-	public AjaxJson doLogin(String key, String password) {
-		
-		// 0、判断 way (1=ID, 2=昵称,3=手机号  )
-    	int way = 2;	
-    	if(NbUtil.isNumber(key)){
-    		way = 1;
-    		if(key.length() == 11){
-    			way = 3;
-    		}
-    	}
-		
-		// 2、获取admin
-        SpAdmin admin = null;	
-        if(way == 1) {
-        	admin = spAdminMapper.getById(Long.parseLong(key)); 
+
+    @Autowired
+    SpAccAdminMapper spAccAdminMapper;
+
+    @Autowired
+    SpAdminMapper spAdminMapper;
+
+    @Autowired
+    SpRolePermissionService spRolePermissionService;
+
+
+    /**
+     * 登录
+     *
+     * @param key      店铺名称
+     * @param password 店铺密码
+     * @return
+     */
+    public AjaxJson doLogin(String key, String password) {
+        return doLogin(key, password, null);
+    }
+
+    public AjaxJson doLogin(String key, String password, String openid) {
+
+        // 0、判断 way (1=ID, 2=昵称,3=手机号  )
+        int way = 2;
+        if (NbUtil.isNumber(key)) {
+            way = 1;
+            if (key.length() == 11) {
+                way = 3;
+            }
+        }
+
+        // 2、获取admin
+        SpAdmin admin = null;
+        if (way == 1) {
+            admin = spAdminMapper.getById(Long.parseLong(key));
         }
-        if(way == 2) {
-        	admin = spAdminMapper.getByName(key); 
+        if (way == 2) {
+            admin = spAdminMapper.getByName(key);
         }
-        if(way == 3) {
-        	admin = spAdminMapper.getByPhone(key); 
+        if (way == 3) {
+            admin = spAdminMapper.getByPhone(key);
         }
-        
+
 
         // 3、开始验证
-        if(admin == null){
-        	return AjaxJson.getError("无此账号");	
+        if (admin == null) {
+            return AjaxJson.getError("无此账号");
         }
-        if(NbUtil.isNull(admin.getPassword2())) {
-        	return AjaxJson.getError("此账号尚未设置密码,无法登陆");
+        if (NbUtil.isNull(admin.getPassword2())) {
+            return AjaxJson.getError("此账号尚未设置密码,无法登陆");
         }
         String md5Password = SystemObject.getPasswordMd5(admin.getId(), password);
-        if(!admin.getPassword2().equals(md5Password)){
-        	return AjaxJson.getError("密码错误");	
+        if (!admin.getPassword2().equals(md5Password)) {
+            return AjaxJson.getError("密码错误");
         }
-        
+
         // 4、是否禁用
-        if(admin.getStatus() == 2) {
-        	return AjaxJson.getError("此账号已被禁用,如有疑问,请联系管理员");	
+        if (admin.getStatus() == 2) {
+            return AjaxJson.getError("此账号已被禁用,如有疑问,请联系管理员");
         }
 
-        // =========== 至此, 已登录成功 ============ 
+        // =========== 至此, 已登录成功 ============
         successLogin(admin);
         StpUtil.login(admin.getId());
-		StpUserUtil.saveAdmin(admin.getId(),admin);
-        
-        // 组织返回参数  
-		SoMap map = new SoMap();
-		map.put("admin", admin);
-		map.put("per_list", spRolePermissionService.getPcodeByRid2(admin.getRoleId()));
-		map.put("tokenInfo", StpUtil.getTokenInfo());
-		return AjaxJson.getSuccessData(map);	
-	}
-	
-	
-	/**
-	 * 指定id的账号成功登录一次 (修改最后登录时间等数据 )
-	 * @param s
-	 * @return
-	 */
-	public int successLogin(SpAdmin s){
-		String loginIp = WebNbUtil.getIP(SpringMVCUtil.getRequest());
-		int line = spAccAdminMapper.successLogin(s.getId(), loginIp);
-		if(line > 0) {
-	        s.setLoginIp(loginIp);
-	        s.setLoginTime(new Date());
-	        s.setLoginCount(s.getLoginCount() + 1);
-		}
+        StpUserUtil.saveAdmin(admin.getId(), admin);
+
+        // 组织返回参数
+        SoMap map = new SoMap();
+        map.put("admin", admin);
+        map.put("per_list", spRolePermissionService.getPcodeByRid2(admin.getRoleId()));
+        map.put("tokenInfo", StpUtil.getTokenInfo());
+        if (StrUtil.isNotEmpty(openid)) {
+            SpAdmin db = spAdminMapper.findByOpenid(openid);
+            if (db!=null&& !db.getId().equals(admin.getId())){
+                db.setOpenid("");
+                spAdminMapper.updateOpenid(db);
+            }
+            admin.setOpenid(openid);
+            spAdminMapper.updateOpenid(admin);
+        }
+        return AjaxJson.getSuccessData(map);
+    }
+
+    /**
+     * 指定id的账号成功登录一次 (修改最后登录时间等数据 )
+     *
+     * @param s
+     * @return
+     */
+    public int successLogin(SpAdmin s) {
+        String loginIp = WebNbUtil.getIP(SpringMVCUtil.getRequest());
+        int line = spAccAdminMapper.successLogin(s.getId(), loginIp);
+        if (line > 0) {
+            s.setLoginIp(loginIp);
+            s.setLoginTime(new Date());
+            s.setLoginCount(s.getLoginCount() + 1);
+        }
         return line;
-	}
-	
-	/**
-	 * 修改手机号  
-	 * @param adminId
-	 * @param newPhone
-	 * @return
-	 */
-	@Transactional(rollbackFor = Exception.class, propagation=Propagation.REQUIRED)
-	public AjaxJson updatePhone(long adminId, String newPhone) {
-		// 修改admin手机号
-		int line = SP.publicMapper.updateColumnById("sys_admin", "phone", newPhone, adminId);
-		return AjaxJson.getByLine(line);
-	}
-	
-	
-	
-	
+    }
+
+    /**
+     * 修改手机号
+     *
+     * @param adminId
+     * @param newPhone
+     * @return
+     */
+    @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
+    public AjaxJson updatePhone(long adminId, String newPhone) {
+        // 修改admin手机号
+        int line = SP.publicMapper.updateColumnById("sys_admin", "phone", newPhone, adminId);
+        return AjaxJson.getByLine(line);
+    }
+
+
 }

+ 4 - 0
sp-server/src/main/resources/application-dev.yml

@@ -71,3 +71,7 @@ wx-config:
     auth-login-url: https://open.weixin.qq.com/connect/oauth2/authorize?appid=${wx-config.app-id}&redirect_uri=REDIRECT_URI&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect
     js-api-token-url: https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=ACCESS_TOKEN&type=jsapi
     openid-url: https://api.weixin.qq.com/sns/oauth2/access_token?appid=${wx-config.app-id}&secret=${wx-config.secret}&code=CODE&grant_type=authorization_code
+    send-msg-url: https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=ACCESS_TOKEN
+    business-notice-template: x-uh28Okx9_Wl1ZXsmx_r2vn3KIixZrZqUw-18R0cqY
+    business-pick-template: M2f0xbVnQNujOCbtDZ6kBGnTK8Uc2Hm7dMguU-dPH9Q
+    business-confirm-template: x-uh28Okx9_Wl1ZXsmx_r2vn3KIixZrZqUw-18R0cqY