shish 3 лет назад
Родитель
Сommit
2605188d1d
3 измененных файлов с 134 добавлено и 52 удалено
  1. 2 1
      ghsApp/src/pagesGys/detailsItem.vue
  2. 118 36
      ghsApp/src/pagesGys/search.vue
  3. 14 15
      ghsApp/src/pagesGys/searchItem.vue

+ 2 - 1
ghsApp/src/pagesGys/detailsItem.vue

@@ -9,7 +9,8 @@
 				<text class="name">{{info.orderSn}} </text>
 			</view>
 			<view class="item-row">
-				<view class="mark">{{ info.addTime.substr(2,11) }} <text v-if="info.yfPayWay ==2" style="margin-left:16upx;color:#333333;">到付</text></view>
+				<view class="mark">{{ info.addTime.substr(2,14) }}
+				<text v-if="info.yfPayWay ==2" style="margin-left:16upx;color:#333333;">到付</text></view>
 			</view>
 			<view v-if="!$util.isEmpty(info.remark)" class="item-row">
 				<view class="mark" style="color:red;font-weight:bold;">{{ info.remark }}</view>

+ 118 - 36
ghsApp/src/pagesGys/search.vue

@@ -29,44 +29,61 @@
     </view>
 	<view class="order-page">
 		<view scroll-y class="shop-list">
-			<block v-if="!$util.isEmpty(selectDataList)">
-				<block v-for="(item, index) in selectDataList" :key="index">
-					<view style="margin-bottom:15upx;font-size:32upx;">
-						ID:{{item}}
-					</view>
-				</block>
+			<block v-if="!$util.isEmpty(getOrderList)">
+
+				<DetailsItem v-for="(item, index) in getOrderList" @delOrder="delOrder" :key="index" :info="item"></DetailsItem>
+
 			</block>
 			<block v-else>
-				<AppWrapperEmpty title="暂无数据" :is-empty="$util.isEmpty(selectDataList)" />
+				<AppWrapperEmpty title="暂无数据" :is-empty="$util.isEmpty(getOrderList)" />
 			</block>
 		</view>
 		<view class="bar-view">
 			<template>
 				<view class="info-view">
-					<view class="details-select">
-						<text class="price">总共 {{ totalOrderNum }} 笔</text>
-					</view>
+					<text class="price">{{ getOrderList.length }}笔 </text>
+					<text class="unit">¥</text>
+					<text class="price">{{ parseFloat(selectTotalAmount) }}</text>
 				</view>
 			</template>
 			<view class="btn-view">
-				<button :class="['admin-button-com', 'blue']" @click="nextStep">下一步</button>
+				<button :class="['admin-button-com', 'blue']" @click="clearSelectedOrder" >结账</button>
 			</view>
 		</view>
 
+		<modal-module :show="showClearModel" @click="confirmClear" :title="'结账'" color="#333" :size="32" padding="30rpx 30rpx" >
+			<template slot="customContent">
+				<view class="select-cmd_bx">
+					<view class="num_bx">
+						<view class="flex">合计金额:{{selectTotalAmount}}</view>
+						<view class="flex">实付金额:<input @focus="modifyPrice = null" v-model="modifyPrice" type="digit"/></view>
+						<view class="flex">优惠金额:{{(selectTotalAmount - modifyPrice).toFixed(2)}}</view>
+						<view class="flex">支付方式:
+							<picker mode="selector" :value="payWay" :range="payWayList" range-key="name" @change="changePayWayFn" class="tui-input" >
+							<div style="border:1upx solid #CCCCCC;width:300upx;height:70upx;line-height:70upx;">{{ payWayData.name }}</div>
+							</picker>
+						</view>
+					</view>
+				</view>
+			</template>
+		</modal-module>
+
 	</view>
 </view>
 </template>
 <script>
 import AppWrapperEmpty from "@/components/app-wrapper-empty";
+import DetailsItem from "./searchItem";
+import ModalModule from "@/components/plugin/modal";
 import { getDebtList,clearOrderApi } from "@/api/gys/index";
 import AppSearchModule from "@/components/module/app-search-number";
 export default {
-	components: { AppWrapperEmpty, AppSearchModule},
+	components: { AppWrapperEmpty,AppSearchModule,DetailsItem,ModalModule},
 	data() {
 		return {
 			totalAmount: "",
 			num: "",
-			selectDataList: [],
+			getOrderList: [],
 			searchList:[],
 			listLoading: false,
       		isAllCheck: false,
@@ -83,31 +100,103 @@ export default {
 	computed:{
 		totalOrderNum(){
 			let num = 0
-			if (!this.$util.isEmpty(this.selectDataList)) {
-				num = this.selectDataList.length
-			}
 			return num
 		},
+		selectTotalAmount() {
+			let amount = 0;
+			if (this.getOrderList) {
+				for (const item of this.getOrderList) {
+					amount=amount+Number(item.realPrice)
+				}
+			}
+			let newAmount = amount.toFixed(2);
+			this.modifyPrice = newAmount
+			return newAmount
+		}
 	},
 	methods: {
+		confirmClear(val) {
+			if(val.index == 0){
+				this.showClearModel = false
+				return false
+			}
+			let ghsId = this.option.id ? this.option.id : 0
+			if (this.$util.isEmpty(this.getOrderList)) {
+				this.$msg("请选择订单");
+				return;
+			}
+			if (this.$util.isEmpty(this.modifyPrice)) {
+				this.$msg("请填写实收金额");
+				return;
+			}
+			let ids = this.getOrderList.map(ele => {
+				return {id:ele.id};
+			});
+			let params = {
+				id:JSON.stringify(ids),
+				ghsId:ghsId,
+				modifyPrice:this.modifyPrice,
+				payWay:this.payWay
+			}
+			let that = this;
+			that.$util.confirmModal({content:'确认提交?'},() => {
+				uni.showLoading({mask:true})
+				clearOrderApi(params).then(ret=>{
+					uni.hideLoading()
+					if(ret.code == 1){
+						that.$msg('结账成功')
+						setTimeout(function(){
+							uni.navigateBack({})
+						},1200)
+					}
+				})
+			})
+
+		},
+		clearSelectedOrder(){
+			if (this.$util.isEmpty(this.getOrderList)) {
+				this.$msg("没有订单");
+				return;
+			}
+			this.showClearModel = true;
+		},
 		clearData(){
 			let that = this
 			this.$util.confirmModal({content:'确认清空?'},() => {
-				that.selectDataList = []
-				uni.removeStorageSync('select_ghs_clear_'+this.option.id)
+				that.getOrderList = []
+				uni.removeStorageSync('selected_cg_ghs_order_clear_'+this.option.id)
+				that.$refs.searchShowRef.close()
 			})
 		},
+		delOrder(info){
+			if (!this.$util.isEmpty(this.getOrderList)) {
+				let index = -1
+				this.getOrderList.forEach((item,idx,arr) => {
+					if(item.id == info.id){
+						index = idx
+					}
+				})
+				if(index > -1){
+					this.getOrderList.splice(index,1)
+				}
+				uni.setStorageSync('selected_cg_ghs_order_clear_'+this.option.id, this.getOrderList)
+			}
+		},
 		addData(item){
-			if (this.$util.isEmpty(this.selectDataList)) {
-				this.selectDataList.push(item.id)
+			if (this.$util.isEmpty(this.getOrderList)) {
+				this.getOrderList.unshift(item)
 			}else{
-				if(this.selectDataList.indexOf(item.id) == -1){
-					this.selectDataList.push(item.id)
+				let has = false
+				for (const ele of this.getOrderList) {
+					if(ele.id == item.id){
+						has = true
+					}
+				}
+				if(has == false){
+					this.getOrderList.unshift(item)
 				}
 			}
-
-			uni.setStorageSync('select_ghs_clear_'+this.option.id, this.selectDataList)
-
+			uni.setStorageSync('selected_cg_ghs_order_clear_'+this.option.id, this.getOrderList)
 			this.$refs.searchShowRef.close()
 		},
 		searchFn(e) {
@@ -117,7 +206,7 @@ export default {
 				that.searchList = [];
 				return false
 			}
-			if(e.length < 5){
+			if(e.length < 4){
 				that.$refs.searchShowRef.close()
 				that.searchList = [];
 				return false
@@ -135,17 +224,10 @@ export default {
 			})
 		},
 		init(){
-			let cache = uni.getStorageSync('select_ghs_clear_'+this.option.id)
+			let cache = uni.getStorageSync('selected_cg_ghs_order_clear_'+this.option.id)
 			if (!this.$util.isEmpty(cache)) {
-				this.selectDataList = cache
-			}
-		},
-		nextStep(){
-			if(this.totalOrderNum <= 0){
-				this.$msg('没有订单')
-				return false
+				this.getOrderList = cache
 			}
-			this.$util.pageTo({url: "/pagesGys/details?id="+this.option.id+'&type=search'})
 		}
 	}
 };
@@ -236,7 +318,7 @@ export default {
 			display: flex;
 			align-items: center;
 			color: #333;
-			font-size: 24upx;
+			font-size:32upx;
 			.iconfont {
 				font-size: 32upx;
 				color: #dddddd;

+ 14 - 15
ghsApp/src/pagesGys/searchItem.vue

@@ -5,7 +5,8 @@
 				<text class="name">{{info.orderSn}} </text>
 			</view>
 			<view class="item-row">
-				<view class="mark">{{ info.addTime.substr(2,11) }} <text v-if="info.yfPayWay ==2" style="margin-left:16upx;color:#333333;">到付</text></view>
+				<view class="mark">{{ info.entryTime ? info.entryTime.substr(2,14) : '' }}
+				<text v-if="info.yfPayWay ==2" style="margin-left:16upx;color:#333333;">到付</text></view>
 			</view>
 			<view v-if="!$util.isEmpty(info.remark)" class="item-row">
 				<view class="mark" style="color:red;font-weight:bold;">{{ info.remark }}</view>
@@ -13,8 +14,12 @@
 			<view class="item-row">
 				<view class="price" style="color:#3385FF;">
 					<text>¥{{ parseFloat(info.realPrice) }}</text>
-					<text v-if="Number(info.tkPrice)>0" style="margin-left:30upx;color:red;">已退¥{{info.tkPrice?parseFloat(info.tkPrice):0}}</text>
+					<text v-if="Number(info.tkPrice)>0" style="margin-left:30upx;color:red;">
+					已退¥{{info.tkPrice?parseFloat(info.tkPrice):0}}
+					</text>
 				</view>
+				<view class="price" style="border:1upx solid #8a7676;border-radius:10upx;font-weight:normal;color:#8a7676;font-size:32upx;width:150upx;height:80upx;justify-content:center;" @click.stop="delOrder(info)">删除</view>
+
 				<view class="price" style="border:1upx solid #67a0f7;border-radius:10upx;font-weight:normal;color:#3385FF;font-size:32upx;width:180upx;height:80upx;justify-content:center;" @click.stop="goToDetai(info)">查看明细</view>
 			</view>
 		</view>
@@ -25,22 +30,17 @@ export default {
 	props: {
 		info: {
 			required: true
-		},
-		isEdit: {
-			type: Boolean,
-			default: false
-		},
-		isCheck: {
-			type: Boolean,
-			default: false
 		}
 	},
 	methods: {
 		goToDetai(item){
-			this.$util.pageTo({
-				url: "/pagesPurchase/info",
-				query: {orderSn:item.orderSn}
-			});
+			this.$util.pageTo({url: "/pagesPurchase/info?orderSn="+item.orderSn})
+		},
+		delOrder(item){
+			let that = this
+			that.$util.confirmModal({content:'确认删除?'},() => {
+				that.$emit('delOrder', item)
+			})
 		}
 	}
 };
@@ -87,7 +87,6 @@ export default {
 		display: flex;
 		align-items: center;
 		justify-content: space-between;
-
 		.mark {
 			font-size: 28upx;
 			font-weight: 400;