|
|
@@ -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;
|