1004749546@qq.com 4 年 前
コミット
c8bb3c89d7

+ 19 - 0
App.vue

@@ -51,6 +51,25 @@
 	.content {
 		padding: 20upx;
 	}
+	.form-input {
+		font-size: 28rpx;
+		color: #333;
+		text-align: right;
+		width: 95%;
+		box-sizing: border-box;
+		height: 60rpx;
+		line-height: 60rpx;
+		&.textarea{
+			height: 240rpx;
+			padding: 24rpx 0;
+			text-align: left;
+		}
+	}
+	
+	.form-input-placeholder {
+		font-size: 28rpx;
+		color: #999;
+	}
 	/* 显示一行省略号 */
 	.ellipsis-one{
 		white-space: nowrap;

+ 118 - 0
components/select/v-select.vue

@@ -0,0 +1,118 @@
+<template>
+	<picker @change="toChange" :value="index" :range="datalist" range-key="dispName">
+		<view style="display: flex;align-items: center;">
+			<input class="form-input" :disabled="disabled" v-model="selected" placeholder-class="form-input-placeholder" :placeholder="placeholder" />
+			<u-icon name="arrow-right" color="#9DA8B5" size="28"></u-icon>
+			<!-- <uni-icons type="arrowright"></uni-icons> -->
+		</view>
+	</picker>
+</template>
+
+<script>
+import { getLookUpDatas, listLookUp } from '@/api/data'
+export default {
+  name: 'v-select',
+  data () {
+    return {
+      selected: '',
+      datalist: [],
+      placeholderText: '请选择',
+      lookUp: [],
+	  index: 0
+    }
+  },
+  props: {
+    disabled: {
+      type: [Boolean, String],
+      default: false
+    },
+    multiple: {
+      type: [Boolean, String],
+      default: false
+    },
+    value: [String, Number, Array],
+    code: {
+      type: String,
+      required: true
+    },
+    placeholder: {
+      type: String,
+      default: ''
+    },
+    size: [String]
+  },
+  computed: {
+    getVal () {
+      return this.value
+    },
+    getPlaceholderText () {
+      let _this = this
+      for (let i = 0; i < _this.lookUp.length; i++) {
+        if (_this.lookUp[i].code == _this.code) {
+          if (this.placeholder === '') _this.placeholderText = _this.lookUp[i].name
+          break
+        }
+      }
+      return _this.placeholderText
+    }
+  },
+  created () {
+    if (this.code) {
+      if (this.placeholder) {
+        this.placeholderText = this.placeholder
+      }
+      getLookUpDatas({
+        type: this.code
+      }).then(result => {
+		  console.log(result, 'result')
+        if (result && result.status + '' === '200') {
+          this.datalist = result.data
+          
+        }
+      })
+    } else {
+      // console.log('请确认传递类型')
+    }
+    // 获取所有数据字典
+    // this.lookUp = this.$store.state.vuex_allLookUp
+  },
+  methods: {
+    getDataList (){
+      return this.datalist
+    },
+    getOptionName (val) {
+      return this.datalist.find((item) => {
+        return item.code == val
+      })
+    },
+    getCodeByName (dispName) {
+      return this.datalist.find((item) => {
+        return item.dispName == dispName
+      })
+    },
+	resetVal(){
+		this.selected = ''
+		this.index = 0
+	},
+	// 赋值
+	setVal(code){
+		let index = this.datalist.findIndex(item=>{
+			return item.code == code
+		})
+		console.log(this.datalist,code,index)
+		this.index = index
+		this.selected = this.datalist[index].dispName
+	},
+    toChange (e) {
+		this.index = e.target.value
+		this.selected = this.datalist[this.index].dispName
+        this.$emit('itemChange', this.datalist[this.index].code)
+    }
+  }
+
+}
+</script>
+
+<style scoped>
+
+</style>

+ 6 - 0
pages.json

@@ -75,6 +75,12 @@
 			"style": {
 				"navigationBarTitleText": "回收统计"
 			}
+		},
+		{
+			"path": "pages/order/finish",		
+			"style": {
+				"navigationBarTitleText": "服务完成"
+			}
 		}
     ],
 	"globalStyle": {

+ 6 - 6
pages/index/index.vue

@@ -14,16 +14,16 @@
 			<view class="header-cont">
 				<view class="cont-item">
 					<text v-if="!titleStatus" >{{numTotal}}</text>
-					<u-loading :show="titleStatus"></u-loading>
+					<!-- <u-loading :show="titleStatus"></u-loading> -->
 					<view>完成订单数(个)</view>
 				</view>
 				<view class="cont-item">
-					<u-loading :show="titleStatus"></u-loading>
+					<!-- <u-loading :show="titleStatus"></u-loading> -->
 					<text v-if="!titleStatus" >{{weightTotal}}</text>
 					<view>回收重量(kg)</view>
 				</view>
 				<view class="cont-item">
-					<u-loading :show="titleStatus"></u-loading>
+					<!-- <u-loading :show="titleStatus"></u-loading> -->
 					<text v-if="!titleStatus" >{{moneyTotal}}</text>
 					<view>交易金额(元)</view>
 				</view>
@@ -206,9 +206,9 @@
 				this.titleStatus = true
 				reserveTotal({}).then(res=>{
 					if(res.status == 200) {
-						this.numTotal = res.data.orderReserveCount
-						this.weightTotal = res.data.totalAllWeight/1000
-						this.moneyTotal = res.data.originalAllAmount
+						this.numTotal = res.data.orderReserveCount || 0
+						this.weightTotal = res.data.totalAllWeight/1000 || 0
+						this.moneyTotal = res.data.originalAllAmount || 0
 					} else {
 						this.numTotal = 0
 						this.weightTotal = 0

+ 54 - 0
pages/order/finish.vue

@@ -0,0 +1,54 @@
+<template>
+	<view class="content">
+		<view class="content-result">
+			<u-image src="/static/def_pay_success.png" width="250" height="180"></u-image>
+			<view class="result-yuyue">服务完成</view>
+			<view class="result-yuyueDetail" @click="seeDetail">返回首页</view>
+		</view>
+	</view>
+</template>
+
+<script>
+	export default{
+		data(){
+			return{
+				
+			}
+		},
+		methods:{
+			seeDetail(){
+				uni.navigateTo({
+				    url: '/pages/index/yuyue'
+				})
+			}
+		}
+	}
+</script>
+
+<style lang="less">
+	.content{
+		width: 100%;
+		height: 100vh;
+		display: flex;
+		text-align: center;
+		justify-content: center;
+		align-items: center;
+		padding: 0;
+		.content-result{
+			.result-yuyue{
+				margin: 40upx 0 140upx;
+				font-size: 40upx;
+				font-family: PingFang SC;
+				font-weight: bold;
+				color: #222222;
+			}
+			.result-yuyueDetail{
+				height: 80upx;
+				line-height: 80upx;
+				background: #4F88F7;
+				border-radius: 30px;
+				color: #fff;
+			}
+		}
+	}
+</style>

+ 103 - 58
pages/order/waitOrderDetail.vue

@@ -18,7 +18,7 @@
 					<view class="care">(切换分类可输入不同回收物的价格和重量)</view>
 				</view>
 				<view class="item flex">
-					<view :class="['item-type', curType == item.code ? 'active' : '']" v-for="item in typeData" :key="item.id">
+					<view :class="['item-type', curType == item.code ? 'active' : '']" v-for="(item,index) in typeData" :key="item.id"  @click="getRow(item.code,index)">
 						{{item.dispName}}
 					</view>
 					<!-- <view class="item-type">
@@ -30,27 +30,30 @@
 					<view>重量(kg)</view>
 					<view>合计金额(元)</view>
 				</view>
-				<view class="item flex justify_between">
+				<view v-if="list.length && list[curIndex].typeList.length" v-for="item in list[curIndex].typeList" :key="item.id" class="item flex justify_between align_center">
 					<view class="flex align_center">
-						<text>黄纸</text>
-						<u-input :custom-style="inputLeftStyle" input-align="center" :clearable="false" v-model="value" placeholder="" type="number" />
+						<text>{{item.name}}</text>
+						<u-input :custom-style="inputLeftStyle" input-align="center" :clearable="false" v-model="item.customerPrice" placeholder="" type="number" />
 					</view>
 					<view class="flex flex_1 align_center">
-						<u-input input-align="center" :clearable="false" v-model="value" placeholder="请输入重量" type="number" />
+						<u-input input-align="center" :clearable="false" v-model="item.rubbishWeight" placeholder="请输入重量" type="number" />
 					</view>
-					<view class="flex_1"></view>
+					<view class="flex_1 flex align_center justify_center">{{item.customerPrice*item.rubbishWeight}}</view>
 				</view>
 			</view>
 			<!-- 金额 -->
 			<view class="item-info">
 				<view class="item flex justify_between">
 					<text>应付金额</text>
-					<text>{{orderInfo.payAmount}} 元</text>
+					<text>{{originalAmount}} 元</text>
 				</view>
 				<view class="item flex justify_between">
 					<text>支付方式</text>
-					<text>线下</text>
+					<v-select class="flex_1" ref="payType" placeholder="请选择支付方式" @itemChange="chooseType" code="ORDER_RESERVE_PAY_TYPE" style="width: 100%"></v-select>
+					<!-- <vSelect :code="ORDER_RESERVE_PAY_TYPE"></vSelect> -->
 				</view>
+				<!-- <view class="item">
+				</view> -->
 			</view>
 			<!-- 服务信息 -->
 			<view class="info-main flex flex_column">
@@ -68,6 +71,9 @@
 				</view>
 			</view>
 		</view>
+		<view class="footer">
+			<u-button @click="submit" :loading="loading" class="flex_1" type="primary">提交</u-button>
+		</view>
 	</view>
 </template>
 
@@ -76,7 +82,11 @@
 	import { orderDetailFind, orderSubmit } from '@/api/order.js'
 	import { getLookUpDatas } from '@/api/data.js'
 	import { reservePriceFind } from '@/api/index.js'
+	import vSelect from '@/components/select/v-select.vue'
 	export default {
+		components: {
+			vSelect
+		},
 		data() {
 			return {
 				orderInfo: {},
@@ -89,11 +99,11 @@
 					color: '#191919'
 				},
 				curType: '', // 当前类型
+				curIndex: 0, // 当前类型index
 				typeData: [], // 垃圾类型数据
-				paperList: [], // 纸张分类价格数据
-				clothesList: [], // 衣物分类价格数据
-				metalList: [], // 金属分类价格数据
-				plasticList: [], // 塑料分类价格数据
+				list: [],
+				payType: '', // 支付方式
+				loading: false
 			}
 		},
 		onLoad(options) {
@@ -110,7 +120,18 @@
 			})
 		},
 		computed: {
-			
+			// 支付总金额
+			originalAmount() {
+				let total = 0
+				if(this.list.length){
+					this.list.map(item =>{
+						item.typeList.map(k =>{
+							total = total + (k.customerPrice*k.rubbishWeight)
+						})
+					})
+				} 
+				return total
+			}
 		},
 		methods: {
 			// 获取订单详情
@@ -126,11 +147,22 @@
 			},
 			// 获取垃圾类型数据
 			getRubbishType() {
+				this.list = []
 				getLookUpDatas({type:'RESERVE_RUBBISH_TYPE'}).then(res=>{
 					console.log(res,'------rrrrrr')
 					if(res.status == 200) {
 						this.typeData = res.data || []
+						this.typeData.map(k =>{
+							let p = {
+								typeCode: k.code,
+								typeList: []
+							}
+							console.log(p,'pppppp')
+							this.list.push(p)
+						})
+						console.log(this.list,'this.list----------')
 						this.curType = this.typeData.length ? this.typeData[0].code : ''
+						this.curIndex = 0
 						this.getRow()
 					} else {
 						this.typeData = []
@@ -138,33 +170,73 @@
 				})
 			},
 			// 查询列表
-			getRow() {
+			getRow(code,num) {
+				this.curType = code || this.curType
+				this.curIndex = num || 0
+				if(this.list[this.curIndex].typeList.length) return
 				reservePriceFind({code:this.curType}).then(res => {
 					if (res.status == 200) {
-						this.list = res.data
-						// 纸质
-						if(this.curType == 'PAPER'){
-							
-						}
-						// 衣物
-						if(this.curType == 'CLOTHES'){
-							
-						}
-						// 金属
-						if(this.curType == 'METAL'){
+						let data = res.data
+						data.forEach(item =>{
+							item.rubbishWeight = ''
+							item.totalAmount = ''
+						})
+						this.$nextTick(()=>{
+							this.list[this.curIndex].typeList = data
+							console.log(this.list[this.curIndex].typeList,this.curIndex,'----------lllll22222222')
+						})
 						
-						}
-						// 塑料类
-						if(this.curType == 'PLASTIC'){
-							
-						}
 					} else {
-						this.list = []
+						this.list[this.curIndex].typeList = []
 						this.total = 0
 						this.noDataText = res.message
 					}
 				})
 			},
+			// 选择支付方式
+			chooseType(code) {
+				this.payType = code
+				console.log(this.payType,'this.payType')
+			},
+			// 提交
+			submit() {
+				let arr = []
+				this.list.map(item =>{
+					item.typeList.map(k =>{
+						if(k.rubbishWeight !=='') {
+							let p = {
+								rubbishType: item.typeCode,   //垃圾大类型
+								rubbishTypeItem: k.code, //   垃圾细分类型
+								rubbishWeight: k.rubbishWeight, //   垃圾重量(克)
+								rubbishPrice: k.rubbishPrice, //   单价
+								totalAmount: k.rubbishWeight* k.rubbishPrice // 总价金额
+							}
+							arr.push(p)
+						}
+					})
+				})
+				let params = {
+					"payType": this.payType, //支付方式
+					originalAmount: this.originalAmount, // 支付总金额
+					contactName:  this.orderInfo.contactName,  //联系人姓名
+					contactMobile:  this.orderInfo.contactMobile, //联系人手机号
+					contactAddress:  this.orderInfo.contactAddress,//联系人地址
+					orderReserveNo: this.orderReserveNo,
+					orderReserveItemEntityList: arr
+				}
+				this.loading = true
+				orderSubmit(params).then(res=>{
+					if(res.status == 200) {
+						uni.showToast({
+							title: res.message
+						})
+						uni.redirectTo({
+							url: '/pages/order/finish?money=' + res.data
+						})
+					}
+					this.loading = false
+				})
+			}
 		},
 	}
 </script>
@@ -316,33 +388,6 @@
 			padding: 20rpx 32rpx;
 			display: flex;
 			background-color: #fff;
-			.btn{
-				flex: 1;
-				height: 84rpx;
-				font-size: 32rpx;
-				text-align: center;
-				line-height: 84rpx;
-			}
-			.btnCancleStyle{
-				color: #666666;
-				background: #E5E5E5;
-				border-radius: 60rpx 0px 0px 60rpx;
-			}
-			.btnPayStyle{
-				color: #191919;
-				background: #FFD100;
-				border-radius: 0rpx 60px 60px 0rpx;
-			}
-			.useBtn{
-				width: 100%;
-				height: 84rpx;
-				font-size: 32rpx;
-				text-align: center;
-				line-height: 84rpx;
-				color: #191919;
-				background: #FFD100;
-				border-radius: 60rpx
-			}
 		}
 	}
 </style>

BIN
static/def_pay_success.png