whx 3 ヶ月 前
コミット
a6e8959747
27 ファイル変更349 行追加72 行削除
  1. 1 1
      virgo.wzfrontend/src/main/resources/static/workark/index.html
  2. 1 1
      virgo.wzfrontend/src/main/resources/static/workark/static/css/9980.961b46d7.css
  3. 1 1
      virgo.wzfrontend/src/main/resources/static/workark/static/js/1148.3c165415.js
  4. 1 1
      virgo.wzfrontend/src/main/resources/static/workark/static/js/1522.5eb13d8e.js
  5. 1 1
      virgo.wzfrontend/src/main/resources/static/workark/static/js/224.0f2aba19.js
  6. 0 0
      virgo.wzfrontend/src/main/resources/static/workark/static/js/2657.193eda88.js
  7. 0 0
      virgo.wzfrontend/src/main/resources/static/workark/static/js/2847.b0fc8b45.js
  8. 0 1
      virgo.wzfrontend/src/main/resources/static/workark/static/js/4844.16d86f1a.js
  9. 1 0
      virgo.wzfrontend/src/main/resources/static/workark/static/js/4844.19574734.js
  10. 1 0
      virgo.wzfrontend/src/main/resources/static/workark/static/js/5211.387337b1.js
  11. 0 1
      virgo.wzfrontend/src/main/resources/static/workark/static/js/5211.8bb912b8.js
  12. 1 0
      virgo.wzfrontend/src/main/resources/static/workark/static/js/5493.38a614ae.js
  13. 0 0
      virgo.wzfrontend/src/main/resources/static/workark/static/js/7081.82b3c400.js
  14. 0 1
      virgo.wzfrontend/src/main/resources/static/workark/static/js/8083.8ccdf938.js
  15. 1 0
      virgo.wzfrontend/src/main/resources/static/workark/static/js/8083.cc74e14c.js
  16. 1 0
      virgo.wzfrontend/src/main/resources/static/workark/static/js/8407.a947c8d7.js
  17. 0 1
      virgo.wzfrontend/src/main/resources/static/workark/static/js/8407.b5e983f9.js
  18. 1 0
      virgo.wzfrontend/src/main/resources/static/workark/static/js/9294.f4092fed.js
  19. 0 1
      virgo.wzfrontend/src/main/resources/static/workark/static/js/9413.518152c9.js
  20. 0 0
      virgo.wzfrontend/src/main/resources/static/workark/static/js/9542.053c11c5.js
  21. 0 1
      virgo.wzfrontend/src/main/resources/static/workark/static/js/9980.5e8846db.js
  22. 0 0
      virgo.wzfrontend/src/main/resources/static/workark/static/js/9991.660775e7.js
  23. 1 1
      virgo.wzfrontend/src/main/resources/static/workark/static/js/app.c30e1ff6.js
  24. 46 0
      virgo.wzfrontend/workark/src/api/serve.js
  25. 11 0
      virgo.wzfrontend/workark/src/api/system.js
  26. 167 57
      virgo.wzfrontend/workark/src/components/website/createOrder.vue
  27. 113 3
      virgo.wzfrontend/workark/src/views/work/serve/list.vue

ファイルの差分が大きいため隠しています
+ 1 - 1
virgo.wzfrontend/src/main/resources/static/workark/index.html


ファイルの差分が大きいため隠しています
+ 1 - 1
virgo.wzfrontend/src/main/resources/static/workark/static/css/9980.961b46d7.css


ファイルの差分が大きいため隠しています
+ 1 - 1
virgo.wzfrontend/src/main/resources/static/workark/static/js/1148.3c165415.js


ファイルの差分が大きいため隠しています
+ 1 - 1
virgo.wzfrontend/src/main/resources/static/workark/static/js/1522.5eb13d8e.js


ファイルの差分が大きいため隠しています
+ 1 - 1
virgo.wzfrontend/src/main/resources/static/workark/static/js/224.0f2aba19.js


virgo.wzfrontend/src/main/resources/static/workark/static/js/2657.44b7a15e.js → virgo.wzfrontend/src/main/resources/static/workark/static/js/2657.193eda88.js


virgo.wzfrontend/src/main/resources/static/workark/static/js/2847.822ac358.js → virgo.wzfrontend/src/main/resources/static/workark/static/js/2847.b0fc8b45.js


ファイルの差分が大きいため隠しています
+ 0 - 1
virgo.wzfrontend/src/main/resources/static/workark/static/js/4844.16d86f1a.js


ファイルの差分が大きいため隠しています
+ 1 - 0
virgo.wzfrontend/src/main/resources/static/workark/static/js/4844.19574734.js


ファイルの差分が大きいため隠しています
+ 1 - 0
virgo.wzfrontend/src/main/resources/static/workark/static/js/5211.387337b1.js


ファイルの差分が大きいため隠しています
+ 0 - 1
virgo.wzfrontend/src/main/resources/static/workark/static/js/5211.8bb912b8.js


ファイルの差分が大きいため隠しています
+ 1 - 0
virgo.wzfrontend/src/main/resources/static/workark/static/js/5493.38a614ae.js


virgo.wzfrontend/src/main/resources/static/workark/static/js/7081.bf0892ca.js → virgo.wzfrontend/src/main/resources/static/workark/static/js/7081.82b3c400.js


ファイルの差分が大きいため隠しています
+ 0 - 1
virgo.wzfrontend/src/main/resources/static/workark/static/js/8083.8ccdf938.js


ファイルの差分が大きいため隠しています
+ 1 - 0
virgo.wzfrontend/src/main/resources/static/workark/static/js/8083.cc74e14c.js


ファイルの差分が大きいため隠しています
+ 1 - 0
virgo.wzfrontend/src/main/resources/static/workark/static/js/8407.a947c8d7.js


ファイルの差分が大きいため隠しています
+ 0 - 1
virgo.wzfrontend/src/main/resources/static/workark/static/js/8407.b5e983f9.js


ファイルの差分が大きいため隠しています
+ 1 - 0
virgo.wzfrontend/src/main/resources/static/workark/static/js/9294.f4092fed.js


ファイルの差分が大きいため隠しています
+ 0 - 1
virgo.wzfrontend/src/main/resources/static/workark/static/js/9413.518152c9.js


virgo.wzfrontend/src/main/resources/static/workark/static/js/9542.7c93f235.js → virgo.wzfrontend/src/main/resources/static/workark/static/js/9542.053c11c5.js


ファイルの差分が大きいため隠しています
+ 0 - 1
virgo.wzfrontend/src/main/resources/static/workark/static/js/9980.5e8846db.js


virgo.wzfrontend/src/main/resources/static/workark/static/js/9991.e9301ddc.js → virgo.wzfrontend/src/main/resources/static/workark/static/js/9991.660775e7.js


ファイルの差分が大きいため隠しています
+ 1 - 1
virgo.wzfrontend/src/main/resources/static/workark/static/js/app.c30e1ff6.js


+ 46 - 0
virgo.wzfrontend/workark/src/api/serve.js

@@ -69,4 +69,50 @@ export function deleteServeById(id) {
 		url: `/api/workarkProduct/delete/${id}`,
 		method: 'delete'
 	})
+}
+/* 
+ * 计算价格
+ * 
+ * 
+ */
+export function countPriceAPI(productId, productCouponIds) {
+	return request({
+		url: `/api/workarkOrderInfo/calculatePrice/${productId}/${productCouponIds}`,
+		method: 'get'
+	})
+}
+/* 
+ * 创建订单
+ * 
+ * 
+ */
+export function createOreder(productId, organizationId, productCouponIds) {
+	return request({
+		url: `/api/workarkOrderInfo/create/${productId}/${organizationId}/${productCouponIds}`,
+		method: 'get'
+	})
+}
+/* 
+ * 查看订单
+ * 
+ * 
+ */
+export function getOrderListByQuery(data) {
+	return request({
+		url: `/api/workarkOrderInfo`,
+		method: 'post',
+		data: data
+	})
+}
+/* 
+ * 分页查看订单
+ * 
+ * 
+ */
+export function getOrderListByQueryAndSize(currPage, pageSize, data) {
+	return request({
+		url: `/api/workarkOrderInfo/${currPage}/${pageSize}`,
+		method: 'post',
+		data: data
+	})
 }

+ 11 - 0
virgo.wzfrontend/workark/src/api/system.js

@@ -97,6 +97,17 @@ export function deleteServeDepartment(id) {
 		url: `/api/workarkProductLevel/${id}`,
 		method: 'delete'
 	})
+}
+/* 
+ * 根据id获取服务
+ * 
+ * 
+ */
+export function getServeDepartmentById(id) {
+	return request({
+		url: `/api/workarkProductLevel/get/${id}`,
+		method: 'get'
+	})
 }
 /* 
  * 根据标识获取服务

+ 167 - 57
virgo.wzfrontend/workark/src/components/website/createOrder.vue

@@ -1,106 +1,197 @@
 <template>
-	<div class="create-order hui-flex">
-		<div class="hui-flex-box">
-			<div class="order-box">
-				<div class="title">订单详情</div>
-				<div class="content">
-					<el-table :data="tableData">
-						<el-table-column label="商品名称" prop="name"></el-table-column>
-						<el-table-column label="数量" width="100">
-							<template>
-								x1
-							</template>
-						</el-table-column>
-						<el-table-column label="价格" prop="price" width="100"></el-table-column>
-					</el-table>
+	<div class="create-order">
+		<div class="hui-flex" v-if="!isCreate">
+			<div class="hui-flex-box">
+				<div class="order-box">
+					<div class="title">订单详情</div>
+					<div class="content">
+						<el-table :data="tableData">
+							<el-table-column label="商品名称" prop="name"></el-table-column>
+							<el-table-column label="数量" width="100">
+								<template>x1</template>
+							</el-table-column>
+							<el-table-column label="价格" prop="price" width="100">
+								<template slot-scope="scope">
+									<span class="color-red">{{scope.row.price}}</span>
+								</template>
+							</el-table-column>
+						</el-table>
+					</div>
 				</div>
-			</div>
-			<div class="order-box">
-				<div class="title" style="border: none;">优惠券</div>
-				<div class="content contents">
-					<div class="coupon-card" v-for="(item,index) in coupon" :key="index" @click="checkCoupon(item)">
-						<div
-							:class="couponChecked.findIndex(node=>node.id === item.id) > -1 ? 'coupon-card-box active' :'coupon-card-box'">
-							<div class="price">
-								<div v-if="item.type === 1">
-									<span class="symbol">¥</span>
-									<span>{{item.couponAmount}}</span>
+				<div class="order-box">
+					<div class="title" style="border: none;">优惠券</div>
+					<div class="content contents">
+						<div :class="returnCouponClass(item) ?'coupon-card' :'coupon-card disabled'"
+							v-for="(item,index) in coupon" :key="index" @click="checkCoupon(item)">
+							<div
+								:class="couponChecked.findIndex(node=>node.id === item.id) > -1 ? 'coupon-card-box active' :'coupon-card-box'">
+								<div class="price">
+									<div v-if="item.type === 1">
+										<span class="symbol">¥</span>
+										<span>{{item.couponAmount}}</span>
+									</div>
+									<div v-else>
+										<span>{{item.discount*100}}</span>
+										<span class="symbol">折</span>
+									</div>
 								</div>
-								<div v-else>
-									<span>{{item.discount*100}}</span>
-									<span class="symbol">折</span>
+								<div class="center-describe">
+									<div class="product">{{item.title}}</div>
+									<div class="sub-title">
+										<span>{{item.type === 1?`满${item.threshold}减${item.couponAmount}`:`满${item.threshold}可用,最高抵扣${item.mostConstraint}`}}</span>
+									</div>
 								</div>
-							</div>
-							<div class="center-describe">
-								<div class="product">{{item.title}}</div>
-								<div class="sub-title">
-									<span>{{item.type === 1?`满${item.threshold}减${item.couponAmount}`:`满${item.threshold}可用,最高抵扣${item.mostConstraint}`}}</span>
+								<div class="icon-check">
+									<i class="el-icon-check"></i>
 								</div>
 							</div>
-							<div class="icon-check">
-								<i class="el-icon-check"></i>
-							</div>
 						</div>
 					</div>
 				</div>
 			</div>
-		</div>
-		<div class="create-order-submit">
-			<div class="create-order-price">
-				<div>
-					<span>应付费用:</span><span class="color-red">¥</span><span class="color-red">90.00</span>
-				</div>
-				<div class="discount-num">
-					<span class="color-red">减 ¥ 0.00</span>
+			<div class="create-order-submit">
+				<div class="create-order-price">
+					<div v-if="isCount" class="color-red">
+						正在计算...
+					</div>
+					<div v-else>
+						<div>
+							<span>应付费用:</span>
+							<span class="color-red">¥</span>
+							<span class="color-red">{{countPriceData.totalFee}}</span>
+						</div>
+						<div class="discount-num">
+							<span class="color-red">减 ¥ <span>{{minus}}</span></span>
+						</div>
+					</div>
 				</div>
+				<el-button type="primary" size="medium" :disabled="isCount" @click="submit" :loading="loading">
+					创建订单
+				</el-button>
 			</div>
-			<el-button type="primary" size="medium">创建订单</el-button>
+		</div>
+		<div class="hui-flex" v-else>
+			<el-result icon="success" title="订单创建成功" :subTitle="subTitle">
+				<template slot="extra">
+					<el-button size="small" @click="lookOrder">查看订单</el-button>
+				</template>
+			</el-result>
 		</div>
 	</div>
 </template>
 
 <script>
 	import {
-		getServeById
+		getServeById,
+		countPriceAPI,
+		createOreder
 	} from '@/api/serve'
 	import {
 		getCouponListByQuery
 	} from '@/api/discount'
+	import {
+		getServeDepartmentById
+	} from '@/api/system'
+
 	export default {
 		props: ['serveId'],
 		data() {
 			return {
 				tableData: [],
 				coupon: [],
-				couponChecked: []
+				couponChecked: [],
+				isCount: false,
+				countPriceData: {
+					productCoupon: [],
+					totalFee: 0
+				},
+				productData: {},
+				loading: false,
+				isCreate: false,
+				subTitle: '',
+				isStacking: false
 			}
 		},
 		mounted() {
 			this.init();
 		},
+		computed: {
+			minus() {
+				let data = this.countPriceData.productCoupon || [];
+				let num = 0;
+				for (var i = 0; i < data.length; i++) {
+					num += data[i].minus
+				}
+				return num;
+			}
+		},
 		methods: {
 			init() {
 				getServeById(this.serveId).then(res => {
 					if (res.state) {
-						this.tableData = [res.data];
-					}
-				})
-				getCouponListByQuery({
-					userId: this.$store.getters.user.userId
-				}).then(res => {
-					if (res.state) {
-						this.coupon = res.data;
+						let data = res.data;
+						this.productData = data;
+						this.tableData = [data];
+						this.countPrice();
+						getCouponListByQuery({
+							userId: this.$store.getters.user.userId,
+							productLevelId: data.productLevelId,
+							state: 1
+						}).then(node => {
+							if (node.state) {
+								this.coupon = node.data;
+							}
+						})
 					}
 				})
 			},
+			returnCouponClass(item) {
+				if (item.threshold > this.productData.price) return false; //大于满减。
+				if (this.couponChecked.findIndex(node => node.id === item.id) > -1) return true; //已选择的返回true
+				if (this.couponChecked.length === 0) return true; //未选择优惠券时都能选择。
+				if (this.isStacking && item.overlayUse === 0) return false; //叠加时不能选择不能叠加优惠券。
+				if (this.isStacking && item.overlayUse === 1) return true; //叠加时能选择叠加优惠券。
+			},
 			checkCoupon(item) {
+				if (!this.returnCouponClass(item)) return;
 				let index = this.couponChecked.findIndex(node => node.id === item.id);
 				if (index === -1) {
 					this.couponChecked.push(item);
 				} else {
 					this.couponChecked.splice(index, 1);
 				}
-				console.log(this.couponChecked);
+				this.isStacking = this.couponChecked.length > 0 ? this.couponChecked[0].overlayUse === 1 : false; //是否可叠加
+				this.countPrice();
+			},
+			countPrice() {
+				this.isCount = true;
+				let couponIds = this.couponChecked.map(node => node.id).join(',') || -1;
+				countPriceAPI(this.productData.id, couponIds).then(res => {
+					if (res.state) {
+						this.countPriceData = res.data;
+					}
+					this.isCount = false;
+				})
+			},
+			submit() {
+				this.loading = true;
+				let couponIds = this.couponChecked.map(node => node.id).join(',') || -1;
+				createOreder(this.productData.id, this.$store.getters.organization.id, couponIds).then(res => {
+					this.loading = false;
+					if (res.state) {
+						this.$message.success('操作成功');
+						this.subTitle = '订单编号:' + res.data.orderNo;
+						this.isCreate = true;
+					}
+				})
+			},
+			lookOrder() {
+				getServeDepartmentById(this.productData.productLevelId).then(res => {
+					if (res.state) {
+						let orderPath = '/work/serve/list/' + res.data.sign;
+						this.$router.push(orderPath);
+					}
+				})
 			}
 		},
 	}
@@ -141,6 +232,22 @@
 				padding-right: 5px;
 			}
 
+			&.disabled {
+				.coupon-card-box {
+					opacity: 0.6;
+					cursor: unset;
+
+					&:hover,
+					&.active {
+						border-color: $--border-color-lighter;
+
+						.icon-check {
+							display: none;
+						}
+					}
+				}
+			}
+
 			.coupon-card-box {
 				background: #fff;
 				padding: 15px;
@@ -151,7 +258,10 @@
 				border: 1px solid $--border-color-lighter;
 				overflow: hidden;
 
-				&:hover,
+				&:hover {
+					border-color: $--color-primary;
+				}
+
 				&.active {
 					border-color: $--color-primary;
 

+ 113 - 3
virgo.wzfrontend/workark/src/views/work/serve/list.vue

@@ -2,16 +2,74 @@
 	<div class="hui-flex hui-content border-box">
 		<div class="hui-content-title">
 			<div class="hui-title-item active">{{titleName}}</div>
-		</div>
-		
+		</div>
+		<div class="hui-flex-box hui-flex hui-table">
+			<div class="hui-flex-box">
+				<el-table :data="tableData" row-key="id" height="100%" v-loading="loading">
+					<el-table-column label="序号" width="50">
+						<template slot-scope="scope">
+							<div style="text-align: center;">{{scope.$index + 1}}</div>
+						</template>
+					</el-table-column>
+					<el-table-column label="订单编号" prop="orderNo"></el-table-column>
+					<el-table-column label="商品名称" prop="title"></el-table-column>
+					<el-table-column label="价格" prop="totalFee"></el-table-column>
+					<el-table-column label="创建时间" prop="createTime"></el-table-column>
+					<el-table-column label="状态" align="center">
+						<template slot-scope="scope">
+							<span>{{scope.row.orderStatus}}</span>
+						</template>
+					</el-table-column>
+					<el-table-column label="操作" width="150">
+						<template slot-scope="scope">
+							<div class="hui-table-operation">
+								<span class="table-operation" v-permission="'/work/property/change/detail'"
+									@click="lookItem(scope.row)">
+									详情
+								</span>
+								<span class="table-operation" v-permission="'/work/property/change/update'"
+									v-if="!scope.row.projectFlowId" @click="updateItem(scope.row)">
+									编辑
+								</span>
+								<span class="table-operation" v-permission="'/work/property/change/delete'"
+									v-if="!scope.row.projectFlowId" @click="deleteItem(scope.row)">
+									删除
+								</span>
+							</div>
+						</template>
+					</el-table-column>
+					<template slot="empty">
+						<el-empty description="暂无数据"></el-empty>
+					</template>
+				</el-table>
+			</div>
+			<div class="hui-content-pagination">
+				<el-pagination :pager-count="9" layout="prev, pager, next" :page-size="pageSize" :total="totalCount"
+					@current-change="currentChange" background>
+				</el-pagination>
+			</div>
+		</div>
 	</div>
 </template>
 
 <script>
+	import {
+		getServeDepartmentBySign
+	} from '@/api/system'
+	import {
+		getOrderListByQueryAndSize
+	} from '@/api/serve'
 	export default {
 		data() {
 			return {
-				titleName: ''
+				titleName: '',
+				tableData: [],
+				currPage: 1,
+				pageSize: 10,
+				totalCount: 0,
+				level: {},
+				filterOption: {},
+				loading: false
 			}
 		},
 		mounted() {
@@ -19,8 +77,60 @@
 				title: '服务列表'
 			};
 			this.titleName = title.title;
+			getServeDepartmentBySign(this.$route.params.type).then(res => {
+				if (res.state && res.data) {
+					this.level = res.data;
+					this.init();
+				}
+			})
 		},
 		methods: {
+			init() {
+				let filterOption = {
+					payOrganizationId: this.$store.getters.organization.id,
+					productLevelId: this.level.id
+				};
+				filterOption = Object.assign(filterOption, this.filterOption);
+				this.loading = true;
+				getOrderListByQueryAndSize(this.currPage, this.pageSize, filterOption).then(res => {
+					if (res.state) {
+						this.tableData = res.data.dataList;
+						this.totalCount = res.data.totalCount;
+					}
+					this.loading = false;
+				})
+			},
+			currentChange(currPage) {
+				this.currPage = currPage;
+				this.init();
+			},
+			updateItem(val) {
+				this.detailId = val.id;
+				this.isUpdate = true;
+				this.visible = true;
+			},
+			updateItemFunc(val, data) {
+				this.loading = true;
+				updateServe({
+					id: data.id,
+					state: val
+				}).then(res => {
+					if (res.state) {
+						this.$message.success('操作成功');
+						this.init();
+					}
+				})
+			},
+			deleteItem(val) {
+				this.$confirm('确定要删除服务?', () => {
+					deleteServeById(val.id).then(res => {
+						if (res.state) {
+							this.$message.success('操作成功');
+							this.init();
+						}
+					})
+				});
+			},
 			getTitleNameByPath() {
 				function findNodeById(nodes, index) {
 					for (const node of nodes) {