Browse Source

添加待付款

web100 2 years ago
parent
commit
731ba50ba4

+ 8 - 0
api/tabBar/shoppingCart.js

@@ -31,4 +31,12 @@ export function getCorpsAddr(data) {
 		method: 'GET',
 		data
 	})
+}
+//待付款
+export function obligationList(data) {
+	return http.request({
+		url: '/blade-sales-part/order/listAll',
+		method: 'GET',
+		data
+	})
 }

+ 2 - 0
api/views/salesSlip/index.js

@@ -15,3 +15,5 @@ export function appDetail(params) {
 		params
 	})
 }
+//订单支付
+

+ 2 - 1
common/setting.js

@@ -9,7 +9,8 @@ module.exports = {
 	// 版本号
 	version: '1.0.0',
 	// 开发环境接口Url
-	devUrl: 'http://192.168.0.106:1080',
+	// devUrl: 'http://192.168.0.106:1080',
+	devUrl: 'http://192.168.8.109:1080',
 	// devUrl: 'https://td.echepei.com/api',
 	// devUrl: 'http://jxy.natapp1.cc/api',
 	// devUrl: 'http://121.37.83.47:10004',

+ 3 - 3
package-lock.json

@@ -5,9 +5,9 @@
   "requires": true,
   "dependencies": {
     "uview-ui": {
-      "version": "2.0.35",
-      "resolved": "https://registry.npmmirror.com/uview-ui/-/uview-ui-2.0.35.tgz",
-      "integrity": "sha512-OfMttN3XkHvQosXfd8bjz8ASTvypPoGzBWmQZBJ871bYMCA7t2bDFPlzjbxUj/5ykAjKnZ8zMUapSwSisVt99g=="
+      "version": "2.0.36",
+      "resolved": "https://registry.npmjs.org/uview-ui/-/uview-ui-2.0.36.tgz",
+      "integrity": "sha512-ASSZT6M8w3GTO1eFPbsgEFV0U5UujK+8pTNr+MSUbRNcRMC1u63DDTLJVeArV91kWM0bfAexK3SK9pnTqF9TtA=="
     }
   }
 }

+ 1 - 1
package.json

@@ -4,7 +4,7 @@
   "description": "易车配批发精灵",
   "main": "main.js",
   "dependencies": {
-    "uview-ui": "^2.0.35"
+    "uview-ui": "^2.0.36"
   },
   "devDependencies": {},
   "scripts": {

+ 8 - 1
pages.json

@@ -83,8 +83,15 @@
 			"style": {
 				"navigationBarTitleText": "订单详情"
 			}
+		},{
+			"path": "salesSlip/obligation",
+			"style": {
+				"navigationBarTitleText": "待付款"
+			}
 		}]
-	}, {
+	}, 
+	
+	{
 		"root": "pages/views",
 		"pages": [{
 			"path": "vehicle/vehicleSeries",

+ 7 - 2
pages/tabBar/center.vue

@@ -7,12 +7,12 @@
 			</u-cell-group>
 			<view style="margin: 10rpx 0;padding: 14px 0;">
 				<u-grid :border="false" col="4">
-					<!-- <u-grid-item @click="pageJump('待付款')">
+					<u-grid-item @click="obligationBtn('待付款')">
 						<u-badge v-for="(item , index) in badgeList" v-if="item.status == 1" :key="index" type="error"
 							max="99" :value="item.count" absolute :offset="[3,15]"></u-badge>
 						<u-icon name="order" color="#919399" size="32"></u-icon>
 						<text style="color: #525454;font-size: 24rpx;">待付款</text>
-					</u-grid-item> -->
+					</u-grid-item>
 					<u-grid-item @click="pageJump('待发货')">
 						<u-badge v-for="(item , index) in badgeList" v-if="item.status == 3" :key="index" type="error"
 							max="99" :value="item.count" absolute :offset="[3,15]"></u-badge>
@@ -96,6 +96,11 @@
 				uni.$u.route('/pages/views/salesSlip/index', {
 					text: value
 				});
+			},
+			obligationBtn(value){
+				uni.$u.route('/pages/views/salesSlip/obligation', {
+					text: value
+				});
 			}
 		}
 	}

+ 4 - 1
pages/tabBar/shoppingCart.vue

@@ -76,6 +76,7 @@
 		shoppingCartUpdate,
 		getCorpsAddr
 	} from '@/api/tabBar/shoppingCart.js'
+import { registerRuntimeCompiler } from "vue"
 	export default {
 		data() {
 			return {
@@ -206,8 +207,10 @@
 					});
 					generateOrder({
 						address: this.addres.belongtoarea + this.addres.detailedAddress,
-						list: data
+						list: data,
 					}).then(res => {
+						console.log(res);
+						return
 						uni.showToast({
 							title: "提交成功",
 							icon: 'none'

+ 2 - 2
pages/views/salesSlip/index.vue

@@ -64,8 +64,8 @@
 					}
 				}
 				// , {
-				// 	name: '付款',
-				//  status: '付款',
+				// 	name: '付款',
+				//  status: '付款',
 				// 	badge: {
 				// 		value: 0
 				// 	}

+ 315 - 0
pages/views/salesSlip/obligation.vue

@@ -0,0 +1,315 @@
+<template>
+	<view>
+		<u-checkbox-group v-model="companyValue" placement="column" @change="companyChange">
+			<view class="collection" v-for="(item,index) in dataList" :key="index">
+				<view>
+					<u-checkbox activeColor="#FD4B09" shape="circle" :customStyle="{marginBottom: '8px'}"
+						:label="item.name" :name="item.name" labelSize="28rpx"></u-checkbox>
+				</view>
+				<view style="margin-left: 20rpx;display: flex;align-items: center;" v-for="(ite,ind) in item.list"
+					:key="ind">
+					<view>
+						<image v-for="(li,inde) in ite.orderItemsList" :key="inde"  :src="li.url"
+							style="width: 200rpx;height: 200rpx;border-radius: 20rpx;">
+						</image>
+					</view>
+					<view class="goods" >
+						<u--text v-for="(ites,inds) in ite.orderItemsList" :text="ites.goodsName" size="24rpx" lines="2"></u--text>
+						<view class="price" v-for="(ites,inds) in ite.orderItemsList">
+							<view>¥{{ites.price}}</view>
+							<view v-if="!editDel">
+								<u-number-box v-model="ites.goodsNum" :min="1" :max="ites.inventory" buttonSize="40rpx"
+									@change="(val)=>{statistics(val,index,ind)}"></u-number-box>
+							</view>
+						</view>
+					</view>
+					<view v-if="editDel">
+						<u-icon name="minus-circle-fill" color="#ff0000" size="52rpx"
+							@click="deleteGoods(ites.id)"></u-icon>
+					</view>
+				</view>
+			</view>
+		</u-checkbox-group>
+		<view style="height: 100rpx;"></view>
+		<view class="submitBar">
+			<view class="bar_view">
+				<view>
+					<u-checkbox-group v-model="radiovalue" placement="column" @change="radioGroupChange">
+						<u-checkbox label="全选" name="全选" activeColor="#FD4B09" shape="circle"></u-checkbox>
+					</u-checkbox-group>
+				</view>
+				<view v-if="!editDel">
+					<view>总计:¥<text>{{totalPrice}}</text></view>
+					<view style="font-size: 22rpx;color: #FD4B09;">运费:¥{{totalFreight}}</view>
+				</view>
+				<view style="width: 200rpx;">
+					<u-button shape="circle" size="small" text="提交订单" v-if="!editDel"
+						:disabled="this.selectedProduct.length == 0"
+						color="linear-gradient(0deg, #FD5003 0%, #FBA680 100%)" @click="submit"></u-button>
+					<u-button shape="circle" size="small" text="删除" v-else :disabled="this.selectedProduct.length == 0"
+						color="linear-gradient(0deg, #FD5003 0%, #FBA680 100%)" @click="deleteShopping"></u-button>
+				</view>
+			</view>
+		</view>
+		<u-empty style="position: absolute;top: 45%;left: 50%;transform:translate(-50%,-50%)"
+			v-if="dataList.length == 0 && !isLoading" mode="car" text="待付款为空" icon="http://cdn.uviewui.com/uview/empty/car.png" />
+	</view>
+</template>
+<script>
+	import {
+		obligationList,
+		generateOrder,
+		shoppingCartUpdate,
+		getCorpsAddr
+	} from '@/api/tabBar/shoppingCart.js'
+import { registerRuntimeCompiler } from "vue"
+import { logo } from '../../../common/setting'
+	export default {
+		data() {
+			return {
+				editDel: false,
+				radiovalue: [],
+				companyValue: [],
+				dataList: [],
+				companyValueLength: 0,
+				selectedProduct: [],
+				totalPrice: 0.00,
+				totalFreight: 0.00,
+				addres: {},
+				isLoading: true
+			}
+		},
+		watch: {
+			companyValue() {
+				if (this.companyValue.length != 0 || this.companyValueLength != 0) {
+					if (this.companyValue.length == this.companyValueLength) {
+						this.radiovalue = ["全选"]
+					} else {
+						this.radiovalue = []
+					}
+				}
+				this.statistics()
+			}
+		},
+		onShow() {
+			this.editDel = false
+			this.companyValue = []
+			this.isLoading = true 
+			obligationList().then(res => {
+				console.log(res);
+				this.dataList = res.data
+				this.companyValueLength = this.dataList.length
+				this.isLoading = false // 添加这一行
+			})
+			getCorpsAddr().then(res => {
+				this.addres = res.data
+			})
+		},
+		methods: {
+			deleteGoods(val) {
+				uni.showLoading({
+					title: '加载中',
+					mask: true
+				});
+				shoppingCartUpdate({
+					ids: val
+				}).then(res => {
+					uni.showToast({
+						title: "删除成功",
+						icon: 'none'
+					});
+					uni.showLoading({
+						title: '加载中',
+						mask: true
+					});
+					this.editDel = false
+					this.companyValue = []
+					obligationList().then(res => {
+						this.dataList = res.data
+						this.companyValueLength = this.dataList.length
+						uni.hideLoading();
+					}).catch(err => {
+						uni.hideLoading();
+					})
+					uni.hideLoading();
+				}).catch(err => {
+					uni.hideLoading();
+				})
+			},
+			deleteShopping() {
+				let data = []
+				for (let item of this.companyValue) {
+					for (let ite of this.dataList) {
+						if (item == ite.name) {
+							for (let it of ite.list) {
+								data.push(it.id)
+							}
+						}
+					}
+				}
+				uni.showLoading({
+					title: '加载中',
+					mask: true
+				});
+				shoppingCartUpdate({
+					ids: data.join(',')
+				}).then(res => {
+					uni.showToast({
+						title: "删除成功",
+						icon: 'none'
+					});
+					uni.hideLoading();
+					uni.showLoading({
+						title: '加载中',
+						mask: true
+					});
+					this.editDel = false
+					this.companyValue = []
+					obligationList().then(res => {
+						this.dataList = res.data
+						this.companyValueLength = this.dataList.length
+						uni.hideLoading();
+					}).catch(err => {
+						uni.hideLoading();
+					})
+				}).catch(err => {
+					uni.hideLoading();
+				})
+			},
+			submit() {
+				if (this.companyValue.length > 0) {
+					let data = []
+					for (let item of this.companyValue) {
+						for (let ite of this.dataList) {
+							if (item == ite.name) {
+								data.push({
+									name: item,
+									list: ite.list
+								})
+							}
+						}
+					}
+					uni.showLoading({
+						title: '加载中',
+						mask: true
+					});
+					generateOrder({
+						address: this.addres.belongtoarea + this.addres.detailedAddress,
+						list: data,
+					}).then(res => {
+						console.log(res);
+						return
+						uni.showToast({
+							title: "提交成功",
+							icon: 'none'
+						});
+						uni.hideLoading();
+						uni.showLoading({
+							title: '加载中',
+							mask: true
+						});
+						this.editDel = false
+						this.companyValue = []
+						obligationList().then(res => {
+							this.dataList = res.data
+							this.companyValueLength = this.dataList.length
+							uni.hideLoading();
+						}).catch(err => {
+							uni.hideLoading();
+						})
+					}).catch(err => {
+						uni.hideLoading();
+					})
+				}
+			},
+			radioGroupChange(e) {
+				this.radiovalue = e
+				if (e.length == 0) {
+					this.companyValue = []
+				} else {
+					for (let li of this.dataList) {
+						if (!this.companyValue.includes(li.name)) {
+							this.companyValue.push(li.name)
+						}
+					}
+				}
+				this.statistics()
+			},
+			statistics(val, index, ind) {
+				if (val) {
+					this.dataList[index].list[ind].goodsNum = val.value
+				}
+				let data = []
+				for (let item of this.companyValue) {
+					for (let ite of this.dataList) {
+						if (item == ite.name) {
+							for (let it of ite.list) {
+								data.push(it)
+							}
+						}
+					}
+				}
+				this.totalPrice = 0
+				this.totalFreight = 0
+				for (let item of data) {
+					for(let orderItem of item.orderItemsList){
+						this.totalPrice += Number(orderItem.price) * Number(item.goodsNum)
+						console.log(this.totalPrice);
+					}
+					if (Number(item.goodsNum) == 1) {
+						this.totalFreight += 5
+					}
+				}
+				this.totalFreight = this.totalFreight.toFixed(2)
+				this.totalPrice = this.totalPrice.toFixed(2)
+				this.selectedProduct = data
+			},
+			companyChange(n) {
+				this.companyValue = n
+			}
+		}
+	}
+</script>
+<style lang="scss" scoped>
+	.collection {
+		background-color: #fff;
+		padding: 20rpx;
+		border-radius: 20rpx;
+		margin-top: 20rpx;
+	}
+
+	.goods {
+		width: 100%;
+		margin-left: 20rpx;
+		height: 200rpx;
+		display: grid;
+		align-content: space-between;
+
+		.price {
+			display: flex;
+			justify-content: space-between !important;
+			margin-top: 20rpx;
+			align-items: center;
+
+			view:nth-child(1) {
+				color: #FD4B09;
+				font-size: 40rpx;
+			}
+		}
+	}
+
+	.submitBar {
+		position: fixed;
+		bottom: 0;
+		background-color: #fff;
+		width: 100%;
+		z-index: 10;
+
+		.bar_view {
+			display: flex;
+			justify-content: space-between;
+			align-items: center;
+			padding: 10rpx;
+		}
+	}
+</style>

+ 12 - 2
pages/views/salesSlip/orderDetails.vue

@@ -102,10 +102,15 @@
 					<u-icon name="close" color="#fff"></u-icon>
 					<view style="color: #fff;">取消订单</view>
 				</view>
-				<view @click="confirmReceipt"
+				<!-- <view @click="confirmReceipt"
 					style="width: 50%;background-color: #FD4B09;display: grid;justify-items: center;height: 100%;">
 					<u-icon name="checkmark" color="#fff"></u-icon>
 					<view style="color: #fff;">立即支付</view>
+				</view> -->
+				<view @click="confirmReceipt"
+					style="width: 50%;background-color: #FD4B09;display: grid;justify-items: center;height: 100%;">
+					<u-icon name="checkmark" color="#fff"></u-icon>
+					<view style="color: #fff;">确认收货</view>
 				</view>
 				<!-- <view v-if="form.status == 2 || form.status == 3" @click="returnGoods"
 					style="width: 100%;background-color: #FD4B09;display: grid;justify-items: center;height: 100%;">
@@ -153,12 +158,17 @@
 				id: onLoad.id
 			}).then(res => {
 				this.form = res.data
+				console.log(this.form);
 				uni.hideLoading();
 			}).catch(err => {
 				uni.hideLoading();
 			})
 		},
-		methods: {}
+		methods: {
+			confirmReceipt(){
+				console.log(1);
+			}
+		}
 	}
 </script>