zpj 2 år sedan
förälder
incheckning
78aeab4808
8 ändrade filer med 445 tillägg och 29 borttagningar
  1. 1 1
      api/laundryOrder.js
  2. 13 0
      api/orderList.js
  3. 1 1
      manifest.json
  4. 36 9
      pages-buy/dry-clean.vue
  5. 331 0
      pages-buy/save-dry.vue
  6. 3 1
      pages-my/user-info.vue
  7. 6 0
      pages.json
  8. 54 17
      pages/order/index.vue

+ 1 - 1
api/laundryOrder.js

@@ -1,6 +1,6 @@
 import {request} from '../service/ajax.js'
 
 const newsUrl = '/api/laundryOrder/'
-// 获取站点
+// 干洗支付订单
 export const laundryPay = (data) => request(newsUrl + 'pay', 'post', { ...data },false)
 

+ 13 - 0
api/orderList.js

@@ -0,0 +1,13 @@
+import {request} from '../service/ajax.js'
+
+const newsUrl = '/api/'
+// 代取订单
+export const expressOrderList = (data) => request(newsUrl + 'expressOrder' + 'list', 'post', { ...data },false)
+
+
+// 团购订单
+export const groupOrderList = (data) => request(newsUrl + 'groupOrder' + 'list', 'post', { ...data },false)
+
+
+// 获取订单列表
+export const ticketOrderList = (data) => request(newsUrl + 'ticketOrder' + 'list', 'post', { ...data },false)

+ 1 - 1
manifest.json

@@ -61,7 +61,7 @@
                 "desc" : "获取您的位置授权,用于更准确的,更快捷的为您服务"
             }
         },
-		"requiredPrivateInfos":["getLocation"]
+        "requiredPrivateInfos" : [ "getLocation" ]
     },
     "mp-alipay" : {
         "usingComponents" : true

+ 36 - 9
pages-buy/dry-clean.vue

@@ -35,7 +35,7 @@
 		
 		<!-- 列表 -->
 		<view class="common-view-css bgc-f" style="overflow: hidden;">
-			<Menu style="height: 100%;" @relCardBuy='relCardBuy'></Menu>
+			<Menu ref="menuBox" style="height: 100%;" @relCardBuy='relCardBuy'></Menu>
 		</view>
 		
 		
@@ -65,7 +65,7 @@
 						<view class="">
 							<uni-icons type="trash" size="18" color="#999"></uni-icons>
 						</view>
-						<view class="fs-28 fw-400 fc-9">清空</view>
+						<view class="fs-28 fw-400 fc-9" @click="cardAllDel()">清空</view>
 					</view>
 				</view>
 				<view class="scroll-view-css box-border-box p-32">
@@ -119,7 +119,7 @@
 </template>
 
 <script>
-	import {setShopIngNumber,setShopIngDel,getShopIngList} from '@/api/shopping.js'
+	import {setShopIngNumber,setShopIngDel,getShopIngList,setShopIngAdd,} from '@/api/shopping.js'
 	import {getCommonText} from '@/api/common.js';
 	
 	import Menu from './dry-mod/menu.vue';
@@ -158,6 +158,23 @@
 			this.getCardList();
 		},
 		methods:{
+			cardAllDel(){
+				if(this.cardData.goods_list.length > 0){
+					setShopIngDel({type:3}).then((res)=>{
+						if(res.code === 1){
+							this.cardData.goods_list = [];
+							this.getCardList();
+							this.$refs.menuBox.getTypeList();
+						}else{
+							tools.error('清空失败')
+						}
+					})
+				}else{
+					tools.error('暂未选择商品')
+				}
+				
+			},
+			
 			relCardBuy(){
 				// 重置购物车
 				this.getCardList();
@@ -194,18 +211,19 @@
 				this.$refs.popupBuy.open()
 			},
 			
-			addred(type,item,info){
+			addred(type,info){
 				if(this.isAJAX){
 					return
 				}
 				this.isAJAX = true;
 				if(type === 1){
 					// 减
-					setShopIngNumber({type:3,goods_id:info.goods_id,category_id:item.type,operation:2}).then((res)=>{
+					setShopIngNumber({type:3,goods_id:info.goods_id,category_id:info.category_id,operation:2}).then((res)=>{
 						if(res.code === 1){
 							this.isAJAX = false;
 							info.num -= 1;
-
+							this.getCardList();
+							this.$refs.menuBox.getTypeList();
 						}else{
 							this.isAJAX = false;
 							tools.error(res.msg)
@@ -214,11 +232,12 @@
 					
 				}else if(type === 2){
 					// 加
-					setShopIngAdd({type:3,goods_id:info.goods_id,category_id:item.type}).then((res)=>{
+					setShopIngAdd({type:3,goods_id:info.goods_id,category_id:info.category_id}).then((res)=>{
 						if(res.code === 1){
 							this.isAJAX = false;
 							info.num += 1;
-
+							this.getCardList();
+							this.$refs.menuBox.getTypeList();
 						}else{
 							this.isAJAX = false;
 							tools.error(res.msg)
@@ -229,7 +248,15 @@
 			},
 			
 			createOrder(){
-				
+				if(this.cardData.goods_list.length == 0){
+					return tools.error('请选择商品')
+				}
+				if(!this.siteData.id){
+					return tools.error('请选择站点')
+				}
+				uni.navigateTo({
+					url:'/pages-buy/save-dry?id=' + this.siteData.id
+				})
 			},
 		},
 	}

+ 331 - 0
pages-buy/save-dry.vue

@@ -0,0 +1,331 @@
+<template>
+	<view class="save-order-box iPhone-bottom flex-common-css box-border-box">
+		<view class="bg-box"></view>
+		<Nav title='提交订单' bgckgroundBox='transparent'></Nav>
+		
+		<view class="scroll-view-css box-border-box p-24">
+			<view class="box-card box-border-box mb-20 bgc-f">
+				<view class="box-input align-items-center box-border-box p-b-20 mb-20">
+					<view class="fs-28 fw-600 w158">姓名</view>
+					<input v-model="fromData.name" type="text" placeholder="请输入姓名">
+				</view>
+				<view class="box-input align-items-center box-border-box p-b-20 mb-20">
+					<view class="fs-28 fw-600 w158">手机号</view>
+					<input v-model="fromData.phone" type="number" placeholder="请输入手机号">
+					<view class="fs-28 fc-41ABF5 code-box" @click="getCode()">{{codeText}}{{isCode?'s':''}}</view>
+				</view>
+				<view class="box-input align-items-center box-border-box p-b-20 mb-20">
+					<view class="fs-28 fw-600 w158">验证码</view>
+					<input v-model="fromData.code" type="number" placeholder="请输入验证码">
+					
+				</view>
+				<view class="box-input align-items-center box-border-box p-b-20 mb-20">
+					<view class="fs-28 fw-600 w158">联系地址</view>
+					<input v-model="fromData.address" type="text" placeholder="请输入联系地址(选填)">
+				</view>
+			</view>
+			
+			<view class="box-card box-border-box mb-20 bgc-f">
+				<view class="box-top box-border-box flex-justify-space" v-for="(item,i) in cardData.goods_list" :key="i">
+					<view class="box-left display-flex">
+						<image :src="item.goods_image" mode="aspectFill"></image>
+						<view class="w336 fs-28 fw-400">{{item.goods_name||''}}</view>
+					</view>
+					<view class="box-right">
+						<view class="fs-32 fw-600 text-align-right mb-12">¥{{item.price||''}}</view>
+						<view class="display-flex align-items-center">
+							<view class="right-only-right-red fw-500 text-align-center fs-36 fc-f" @click="addred(1,item)">-</view>
+							<view class="right-only-right-2 text-align-center fs-28 fw-400">{{item.number}}</view>
+							<view class="right-only-right-add fw-500 text-align-center fs-36 fc-f" @click="addred(2,item)">+</view>
+						</view>
+					</view>
+				</view>
+				<view class="box-buttom text-align-right">
+					<span class="fs-28 fc-9 fw-400">共{{cardData.total_num||'0'}}件,</span>
+					<span class="fs-28 fc-0 fw-400">合计¥</span>
+					<span class="fs-44 fc-0 fw-b">{{cardData.total_price||'0'}}</span>
+				</view>
+			</view>
+			
+			<view class="box-card box-border-box mb-20 bgc-f flex-justify-space">
+				<view class="fs-28 fw-600 w158">备注</view>
+				<input v-model="fromData.note" class="text-align-right" type="text" placeholder="请填写你的备注">
+			</view>
+			
+			<view class="box-card box-border-box mb-20 bgc-f flex-justify-space">
+				<view class="fs-28 fw-600 w158">支付方式</view>
+				<view class="wx-box display-flex">
+					<image src="@/static/img/common/wx-zf.png" mode="scaleToFill"></image>
+					<view class="fs-28 fw-400 ml-10">微信支付</view>
+				</view>
+			</view>
+		</view>
+		
+		<view class="bottom-box box-border-box p-24">
+			<view class="flex-justify-space">
+				<view class="align-items-flex-end box-1">
+					<span class="fs-28 fc-f fw-600">¥</span>
+					<span class="fs-44 fc-f fw-600">{{cardData.total_price||'0'}}</span>
+				</view>
+				<view class="text-align-center box-2 fs-32 fc-f fw-600" @click="toSave()">立即支付</view>
+			</view>
+		</view>
+	</view>
+</template>
+
+<script>
+	import {getCode} from '@/api/common.js';
+	import {setShopIngNumber,getShopIngList,setShopIngAdd,} from '@/api/shopping.js';
+	import {laundryCreate} from '@/api/laundry.js';
+	import {laundryPay} from '@/api/laundryOrder.js';
+	
+	import tools from "@/service/tools";
+	
+	export default {
+		data(){
+			return{
+				isCode:false,
+				codeText:'获取验证码',
+				
+				fromData:{
+					name:'',
+					code:'',
+					address:'',
+					phone:'',
+					
+					note:'',
+					site_id:'',
+					school_id:'',
+				},
+				isAJAX:false,
+				
+				goodsData:{},
+				
+				cardData:{
+					goods_list:[],
+					total_num:0,
+					total_price:0,
+				},
+			}
+		},
+		onLoad(e) {
+			this.fromData.site_id = e.id;
+			this.getCardList();
+		},
+		methods:{
+			getCardList(){
+				getShopIngList({type:3}).then((res)=>{
+					if(res.code === 1){
+						this.cardData = res.data;
+					}
+				})
+			},
+			
+			getCode(){
+				if (this.isCode) {
+					return
+				}
+				this.isCode = true;
+				getCode({phone:this.fromData.phone,send_type:'ticket_order'}).then((res)=>{
+					if(res.code === 1){
+						this.codeText = 60;
+						let timer = setInterval(() => {
+						  this.codeText -= 1;
+						  if (this.codeText <= 0) {
+						    clearInterval(timer);
+							this.isCode = false;
+							this.codeText = '获取验证码'
+						  }
+						}, 1000);
+					}else{
+						this.isCode = false;
+						tools.error('获取验证码失败,请稍后重试')
+					}
+				})
+				
+			},
+			
+			toSave(){
+				if (this.isAJAX) {
+					return
+				}
+				this.isAJAX = true;
+				this.fromData.school_id = uni.getStorageSync('school_id');
+				laundryCreate(this.fromData).then((res)=>{
+					if(res.code === 1){
+						laundryPay({order_id:res.data.order_id}).then((ret)=>{
+							if(ret.code === 1){
+								uni.requestPayment({
+								  provider: "wxpay", //支付类型-固定值
+								  timeStamp: ret.data.wx_pay.timeStamp + "", // 时间戳(单位:秒)
+								  nonceStr: ret.data.wx_pay.nonceStr, // 随机字符串
+								  package: ret.data.wx_pay.package, // 固定值
+								  signType: ret.data.wx_pay.signType, //固定值
+								  paySign: ret.data.wx_pay.paySign, //签名
+								  success: (ren) => {
+								    tools.success("支付成功");
+									this.isAJAX = false;
+									setTimeout(()=>{
+										uni.switchTab({
+											url:"/pages/order/index"
+										})
+									},1500)
+								  },
+								  fail: (err) =>{
+									this.isAJAX = false;
+								    tools.error("支付失败");
+								  },
+								});
+							}else{
+								this.isAJAX = false;
+								tools.error("支付失败");
+							}
+						})
+					}else{
+						this.isAJAX = false;
+						tools.error(res.msg);
+					}
+				})
+			},
+			
+			addred(type,info){
+				if(this.isAJAX){
+					return
+				}
+				this.isAJAX = true;
+				if(type === 1){
+					if(info.number <= 1){
+						this.isAJAX = false;
+					}else{
+						// 减
+						setShopIngNumber({type:3,goods_id:info.goods_id,category_id:info.category_id,operation:2}).then((res)=>{
+							if(res.code === 1){
+								this.isAJAX = false;
+								info.number -= 1;
+								this.getCardList();
+							}else{
+								this.isAJAX = false;
+								tools.error(res.msg)
+							}
+						})
+					}
+				}else if(type === 2){
+					// 加
+					setShopIngAdd({type:3,goods_id:info.goods_id,category_id:info.category_id}).then((res)=>{
+						if(res.code === 1){
+							this.isAJAX = false;
+							info.number += 1;
+							this.getCardList();
+						}else{
+							this.isAJAX = false;
+							tools.error(res.msg)
+						}
+					})
+					
+				}
+			},
+		},
+	}
+</script>
+
+<style scoped lang="scss">
+	.save-order-box{
+		position: relative;
+		
+		.right-only-right-red{
+			width: 44rpx;
+			height: 44rpx;
+			line-height: 40rpx;
+			border-radius: 12rpx;
+			border: 1rpx solid #41ABF5;
+			color: #41ABF5;
+		}
+		.right-only-right-add{
+			width: 44rpx;
+			height: 44rpx;
+			line-height: 40rpx;
+			background: linear-gradient( 117deg, #57CAFF 0%, #41ABF5 100%);
+			border-radius: 12rpx;
+		}
+		.right-only-right-2{
+			min-width: 50rpx;
+		}
+		
+		.bg-box{
+			width: 100%;
+			height: 448rpx;
+			filter: blur(80rpx);
+			background: linear-gradient(to right,rgba(176, 252, 250, 0.6),rgba(249,246,224,0.87),rgba(249,246,224,0.87));
+			position: absolute;
+			top: 0;
+			left: 0;
+			z-index: -1;
+		}
+		.bottom-box{
+			background-color: #fff;
+			.box-1{
+				flex: 1;
+				height: 100rpx;
+				background: #333;
+				border-radius: 200rpx 0rpx 0rpx 200rpx;
+				box-sizing: border-box;
+				padding-left: 32rpx;
+				padding-bottom: 20rpx;
+			}
+			.box-2{
+				width: 200rpx;
+				height: 100rpx;
+				line-height: 100rpx;
+				background: #41ABF5;
+				border-radius: 0rpx 200rpx 200rpx 0rpx;
+				text-align: center;
+			}
+		}
+		.box-card{
+			width: 100%;
+			min-height: 88rpx;
+			border-radius: 20rpx;
+			padding: 24rpx 24rpx 0 24rpx;
+			.box-top{
+				padding-bottom: 24rpx;
+				border-bottom: 2rpx solid #F9F9F9;
+				margin-bottom: 24rpx;
+				.box-left{
+					image{
+						width: 108rpx;
+						height: 108rpx;
+						border-radius: 8rpx;
+						margin-right: 16rpx;
+					}
+					.w336{
+						width: 336rpx;
+					}
+				}
+			}
+			.box-buttom{
+				padding-bottom: 24rpx;
+			}
+		}
+		.box-input{
+			border-bottom: 2rpx solid #F9F9F9;
+			position: relative;
+			.w158{
+				width: 158rpx;
+			}
+			input{
+				font-size: 28rpx;
+			}
+			.code-box{
+				position: absolute;
+				right: 0;
+				top: 0;
+			}
+		}
+		.wx-box{
+			image{
+				width: 40rpx;
+				height: 40rpx;
+			}
+		}
+	}
+</style>

+ 3 - 1
pages-my/user-info.vue

@@ -73,7 +73,9 @@
 			},
 			
 			goToUrl(type) {
-				if (type === 1) {
+				if(type === 0){
+					
+				}else if (type === 1) {
 					// 昵称
 					uni.navigateTo({
 						url: '/pages-my/set-user-name'

+ 6 - 0
pages.json

@@ -135,6 +135,12 @@
 						"navigationBarTitleText": "干洗"
 					}
 				},
+				{
+					"path": "save-dry",
+					"style": {
+						"navigationBarTitleText": "干洗提交订单"
+					}
+				},
 				{
 					"path": "dry-mod/select-shop",
 					"style": {

+ 54 - 17
pages/order/index.vue

@@ -4,46 +4,83 @@
 		
 		<view class="nav-box box-border-box bgc-f display-flex">
 			<view class="nav-item" :class="type == item.id?'fs-36 fw-600':'fs-34 fw-400'" 
-			v-for="(item,i) in navList" :key="i">
+			v-for="(item,i) in navList" :key="i" @click="selectType(item.id)">
 				{{item.name}}
 				<view v-if="type == item.id" class="nav-item-x"></view>
 			</view>
 		</view>
 		
-		<scroll-view :scroll-y="true" class="scroll-view-css" @scrolltolower="scrolltolower">
+		
+		<view v-if="list.length == 0" class="scroll-view-css">
+			<EnBlank :customSrc='true'>
+				<template v-slot:blankImg>
+					<image class="black-custom-img" src="@/static/img/common/no-order.png" mode=""></image>
+				</template>
+			</EnBlank>
+		</view>
+		
+		<scroll-view v-else :scroll-y="true" class="scroll-view-css" @scrolltolower="scrolltolower">
 			
 		</scroll-view>
 	</view>
 </template>
 
 <script>
+	import tools from '@/service/tools';
+	import EnBlank from "@/components/en-utils/en-blank/en-blank";
+	
 	export default {
-		components: {},
+		components: {EnBlank},
 		data() {
 			return {
-				type:2,
+				type:1,
 				navList:[
-					{name:'外卖',id:2},
-					{name:'外卖',id:1},
-					{name:'外卖',id:1},
 					{name:'外卖',id:1},
-					{name:'外卖',id:1},
-					{name:'外卖',id:1},
-					{name:'外卖',id:1},
-					{name:'外卖',id:1},
-				]
+					{name:'代取',id:2},
+					{name:'团购',id:3},
+					{name:'票务',id:4},
+					{name:'干洗',id:5},
+				],
+				page:1,
+				list:[],
+				total:0,
 			};
 		},
-		onLoad(e) {
-			
-		},
-		mounted() {
-			
+		onShow() {
+			this.resetList();
 		},
+
 		methods: {
+			getList(){
+				if(this.type === 1){
+					
+				}else if(this.type === 2){
+					
+				}else if(this.type === 3){
+					
+				}else if(this.type === 4){
+					
+				}else if(this.type === 5){
+					
+				}
+			},
+			
+			resetList(){
+				this.page = 1;
+				this.list = [];
+				this.getList();
+			},
+			selectType(type){
+				if(type != this.type){
+					this.type = type;
+					this.resetList();
+				}
+			},
+			
 			scrolltolower() {
 				console.log('触底');
 			},
+			
 		},
 	}
 </script>