From ba8ce4451b48b5902a307df075442bf016b5e4ae Mon Sep 17 00:00:00 2001
From: queenwuli <942534046@qq.com>
Date: Mon, 11 Jan 2021 17:06:21 +0800
Subject: [PATCH] Merge branch 'master' of https://gitee.com/jyyforjava/hive-app into master
---
hive-app/pages/workbench/confirmOrder.vue | 170 +++++++++++++++++++++++++++++++++++++++++++-------------
1 files changed, 129 insertions(+), 41 deletions(-)
diff --git a/hive-app/pages/workbench/confirmOrder.vue b/hive-app/pages/workbench/confirmOrder.vue
index fdc0db2..e674295 100644
--- a/hive-app/pages/workbench/confirmOrder.vue
+++ b/hive-app/pages/workbench/confirmOrder.vue
@@ -1,84 +1,172 @@
<template>
<!-- 确认订单 -->
<view class="container">
- <view class="header flex align-center mt-10">
- <image class="header-img" src="../../static/images/head-img.jpg"></image>
- <view class="ml-10">
- <view class="font-16">
- <text>李某</text>
- <text class="ml-20">15588881111</text>
+ <view class="header">
+ <image class="header-img" :src="memberInfo.photo?memberInfo.photo:'../../static/images/default-avatar.png'"></image>
+ <view>
+ <view>
+ <text>{{memberInfo.vipName}}</text>
+ <text class="ml-20">{{memberInfo.phone}}</text>
</view>
- <text class="font-14 gray mt-5">普通会员</text>
+ <text class="font-14 gray mt-5">{{memberInfo.vipLevel || '-'}}</text>
</view>
</view>
- <view class="content flex flex-v mt-10">
- <view class="content-row flex justify-between align-center flex-1" v-for="item in 4">
+ <view class="content">
+ <view class="list-item" v-for="item in list">
<view class="flex align-center">
- <image class="centent-img" mode="aspectFill" src="../../static/images/product.jpg"></image>
- <view class="flex flex-v font-12 ml-10">
- <text>[项目] 肽妍氨基酸平衡基础洁面乳</text>
- <text class="gray">×1</text>
+ <image class="img" mode="aspectFill" :src="item.img?item.img:'../../static/images/no-img.png'"></image>
+ <view>
+ <text>{{item.name}}</text>
+ <text class="gray block mt-5">×{{item.num}}</text>
</view>
</view>
<view>
- <text>¥400.00</text>
+ <text class="font-14">¥{{item.price}}</text>
</view>
</view>
- <view class="content-row flex justify-between">
- <text class="blue">共5件商品</text>
- <view class="flex align-center">
- <text>合计:</text>
- <text class="red ml-10">¥90,000.00</text>
- </view>
+ <view class="list-footer">
+ <text class="blue">共{{totalCount}}件商品</text>
+ <text>
+ 合计:<text class="price">¥{{totalAmount}}</text>
+ </text>
</view>
</view>
- <navigator url="./submitSucceed">
- <button class="sticky-footer blue-btn">确认提交</button>
- </navigator>
+ <view class="footer">
+ <button :disabled="isDisabled" class="blue-btn" @click="createOrder">确认提交</button>
+ </view>
</view>
</template>
<script>
export default{
data(){
- return{}
+ return{
+ memberInfo: {},
+ list: [],
+ id:'',
+ isDisabled: false
+ }
+ },
+ onLoad(options) {
+ this.id = options.id;
+ this.list = JSON.parse(decodeURIComponent(options.list));
+ this.loadMemberInfo();
+ },
+ computed:{
+ // 购物车总数量
+ totalCount(){
+ let count = 0;
+ this.list.forEach((item) => {
+ count += item.num;
+ })
+ return count;
+ },
+ // 购物车总金额
+ totalAmount(){
+ let amount = 0;
+ this.list.forEach((item) => {
+ amount += item.price * item.num;
+ })
+ return amount;
+ }
},
methods:{
+ loadMemberInfo(){
+ this.$httpUtils.request('/api/vip/findVipInfoById/'+this.id).then((res) => {
+ if(res.status == 200){
+ this.memberInfo = res.mapInfo.vipInfo;
+ }
+ })
+ },
+ createOrder(){
+ this.isDisabled = true;
+ let orderList = this.list.map((item) => {
+ return {
+ "count": item.num,
+ "goodsId": item.id,
+ "goodsType": item.goodsType,
+ "isFree": item.isPresent
+ }
+ })
+ this.$httpUtils.request('/api/order/createOrder', {
+ items: orderList,
+ vipId: this.id
+ }, 'POST').then((res) => {
+ if(res.status == 200){
+ uni.navigateTo({
+ url: './submitSucceed'
+ })
+ }
+ this.$toast.info(res.info);
+ this.isDisabled = false;
+ }).catch(() => {
+ this.isDisabled = false;
+ })
+ }
}
}
</script>
<style>
+ page{
+ background: #F6F6F8;
+ }
.container{
- padding: 10px;
+ padding-top: 10px;
+ padding-bottom: 70px;
+ }
+ .header{
+ display: flex;
+ align-items: center;
+ border: 1px solid #EDEAF4;
+ padding: 10px 10px;
+ background: #FFFFFF;
+ font-size: 16px;
}
.header-img{
width: 48px;
height: 48px;
border-radius: 50%;
- }
- .centent-img{
- width: 36px;
- height: 36px;
- border-radius: 4px;
- }
- .header{
- border: 1px solid #EDEAF4;
- box-shadow:0 6px 6px rgba(237,234,244,0.5);
- border-radius: 4px;
- padding: 10px 10px;
+ margin-right: 10px;
}
.content{
+ margin: 10px 10px;
+ padding: 0 10px 0;
+ background: #FFFFFF;
border: 1px solid #EDEAF4;
box-shadow:0 6px 6px rgba(237,234,244,0.5);
border-radius: 4px;
- padding: 10px;
}
- .content-row{
+ .list-item{
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
border-bottom: 1px solid #EDEAF4;
- padding: 10px 5px;
+ padding: 12px 5px;
+ font-size: 13px;
}
- .content-row:nth-last-child(1){
- border: 0;
+ .list-item .img{
+ width: 40px;
+ height: 40px;
+ border-radius: 4px;
+ margin-right: 10px;
+ }
+ .list-footer{
+ display: flex;
+ justify-content: space-between;
+ padding: 15px 0;
+ font-size: 16px;
+ }
+ .list-footer .price{
+ color: #FA5151;
+ font-weight: 700;
+ }
+ .footer{
+ position: fixed;
+ left: 10px;
+ right: 10px;
+ bottom: 0;
+ padding-bottom: 20px;
+ background: #F6F6F8;
}
</style>
--
Gitblit v1.9.1