|
@@ -1,16 +1,18 @@
|
|
|
<template>
|
|
|
- <view class="page">
|
|
|
+ <!-- v-if="info.id" -->
|
|
|
+ <view class="page" >
|
|
|
+
|
|
|
<view class="pro-sec flex-row justify-between section_3">
|
|
|
<view class="flex-row">
|
|
|
- <image src="/static/temp/pro.png" class="image_5" mode="aspectFill" />
|
|
|
+ <image :src="info.goods_img" class="image_5" mode="aspectFill" />
|
|
|
<view class="flex-col group_7">
|
|
|
<view class="flex-col items-start">
|
|
|
- <text class="text_2 clamp">幸福西饼Rice盲盒</text>
|
|
|
- <view class="stars align-center"><image src="/static/mang_star.png" class="image_6" v-for="(item, idx) in 3" :key="idx" /></view>
|
|
|
+ <text class="text_2 clamp">{{info.goods_name}}</text>
|
|
|
+ <view class="stars align-center"><image src="/static/mang_star.png" class="image_6" v-for="(item, idx) in info.rank" :key="idx" /></view>
|
|
|
</view>
|
|
|
<view class="group_9">
|
|
|
<text class="text_3">¥</text>
|
|
|
- <text class="text_4">149.00</text>
|
|
|
+ <text class="text_4">{{info.shop_price}}</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -32,10 +34,10 @@
|
|
|
<view class="loc-sec flex-col">
|
|
|
<view class="flex-row section_5">
|
|
|
<view class="flex-col items-start group_11">
|
|
|
- <text class="text_9 clamp">幸福西饼万达店</text>
|
|
|
- <text class="text_11 clamp2">长安路与香港路交汇处万达广场3楼1104</text>
|
|
|
+ <text class="text_9 clamp">{{info.shop_name}}</text>
|
|
|
+ <text class="text_11 clamp2">{{info.full_address}}</text>
|
|
|
</view>
|
|
|
- <view class="align-center group_12">
|
|
|
+ <view class="align-center group_12" @tap="makePhone">
|
|
|
<view class="section_6"></view>
|
|
|
<image
|
|
|
src="/static/confirm-phone.png"
|
|
@@ -43,9 +45,19 @@
|
|
|
/>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view class="flex-row justify-between group_13">
|
|
|
+ <view class="flex-row justify-between group_13" @tap="navTo('/pages/address/address',{sourcePage:'mang'},{isCheckLogin:true})">
|
|
|
+ <text class="text_12">您的地址</text>
|
|
|
+ <view class="flex-row" >
|
|
|
+ <text class="text_14 clamp" :class="{active: addrInfo.address}">{{addrInfo.address? addrInfo.address : '请选择'}}</text>
|
|
|
+ <image
|
|
|
+ src="/static/confirm-rarrow.png"
|
|
|
+ class="image_8"
|
|
|
+ />
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="flex-row justify-between group_13" @tap="openTime">
|
|
|
<text class="text_12">自提时间</text>
|
|
|
- <view class="flex-row" @tap="openTime">
|
|
|
+ <view class="flex-row" >
|
|
|
<text class="text_14" :class="{active: show_time}">{{show_time? show_time : '请选择'}}</text>
|
|
|
<image
|
|
|
src="/static/confirm-rarrow.png"
|
|
@@ -57,12 +69,12 @@
|
|
|
<view class="price-sec flex-col">
|
|
|
<view class="flex-row justify-between group_15">
|
|
|
<text class="text_16">商品总额</text>
|
|
|
- <text class="text_17">¥149.00</text>
|
|
|
+ <text class="text_17">¥{{total}}</text>
|
|
|
</view>
|
|
|
- <view class="flex-row justify-between group_13">
|
|
|
+ <view class="flex-row justify-between group_13" @tap="showCoupons">
|
|
|
<text class="text_12">优惠券</text>
|
|
|
- <view class="flex-row group_16" @tap="showCoupons">
|
|
|
- <text class="text_14">请选择</text>
|
|
|
+ <view class="flex-row group_16" >
|
|
|
+ <text class="text_14" :class="{active: coupon_price>0}">{{ coupon_price>0 ? `-${coupon_price}`: '请选择'}}</text>
|
|
|
<image
|
|
|
src="/static/confirm-rarrow.png"
|
|
|
class="image_8"
|
|
@@ -73,7 +85,7 @@
|
|
|
<view class="note-sec flex-col">
|
|
|
<text class="text_20">订单备注</text>
|
|
|
<view class="flex-col items-start text-wrapper">
|
|
|
- <textarea class="area" placeholder="请输入备注信息"></textarea>
|
|
|
+ <textarea class="area" placeholder="请输入备注信息" v-model="remark"></textarea>
|
|
|
</view>
|
|
|
</view>
|
|
|
<safeArea height="128rpx">
|
|
@@ -83,10 +95,10 @@
|
|
|
<text class="text_22">待支付</text>
|
|
|
<view class="group_18 align-center">
|
|
|
<text class="text_23">¥</text>
|
|
|
- <text class="text_24 clamp">151.00</text>
|
|
|
+ <text class="text_24 clamp">{{realTotal}}</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view class="flex-col items-center text-wrapper_1"><text class="text_25">立即支付</text></view>
|
|
|
+ <view class="flex-col items-center text-wrapper_1" :class="{disabled: isSubmitted}" @tap="$tools.throttle(submit)"><text class="text_25">立即支付</text></view>
|
|
|
</view>
|
|
|
</template>
|
|
|
</safeArea>
|
|
@@ -101,11 +113,14 @@
|
|
|
</view>
|
|
|
<view class="content-wrap">
|
|
|
<scroll-view scroll-y="true" class="scroll">
|
|
|
- <view class="item flex-col justify-center" v-for="(item,idx) in 10" :key="idx">
|
|
|
- <view class="name clamp">店铺优惠1</view>
|
|
|
+ <view class="item flex-col justify-center"
|
|
|
+ v-for="(item,idx) in couponList" :key="idx"
|
|
|
+ @tap="tapCoupon(idx)"
|
|
|
+ >
|
|
|
+ <view class="name clamp">{{item.title}}</view>
|
|
|
<view class="tips">
|
|
|
<text class="stxt">消费金额</text>
|
|
|
- <text class="mtxt">满30减5</text>
|
|
|
+ <text class="mtxt">{{item.handel_des}}</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
</scroll-view>
|
|
@@ -125,49 +140,75 @@ export default {
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
- stock: 10000,
|
|
|
+ id:'', //盲盒id
|
|
|
+ shopId:'', //店铺id
|
|
|
+ info:{},
|
|
|
+ stock: 1000000,
|
|
|
number: 1,
|
|
|
- show_time:'', //自提时间
|
|
|
+
|
|
|
couponList: [], //优惠券列表
|
|
|
useCouponIndex: -1,
|
|
|
coupon_price: 0.0, //优惠券金额
|
|
|
- price: 0.0, //商品金额
|
|
|
- total: 0.0 ,//实付金额
|
|
|
+ total: 0.0 ,//总额
|
|
|
+ realTotal:0.0,//实付金额
|
|
|
+
|
|
|
startdate: '',
|
|
|
enddate: '2042-05-30 23:59',
|
|
|
+ show_time:'', //自提时间
|
|
|
+
|
|
|
+ address:{},
|
|
|
+
|
|
|
+ remark:'',
|
|
|
+ pay_type: '', //1=余额支付,2微信支付
|
|
|
};
|
|
|
},
|
|
|
- onLoad() {
|
|
|
+ async onLoad(e) {
|
|
|
let date = new Date();
|
|
|
- this.startdate = this.$tools.handleDatetime(date);
|
|
|
+ this.startdate = this.$tools.handleDateTime(date);
|
|
|
+ this.id =e.id;
|
|
|
+ this.shopId = e.shopId;
|
|
|
+ await this.getInfo();
|
|
|
+ this.number = 1;
|
|
|
+ this.stock = this.info.num;
|
|
|
+ this.calcTotal();
|
|
|
},
|
|
|
methods: {
|
|
|
+ async getInfo(){
|
|
|
+ let sendData={
|
|
|
+ goods_id:this.id,
|
|
|
+ lng: this.addrInfo.address ? this.addrInfo.address_lng : '',
|
|
|
+ lat: this.addrInfo.address ? this.addrInfo.address_lat : '',
|
|
|
+ }
|
|
|
+ let res = await this.$request('goods.info',sendData);
|
|
|
+ this.info = res.data.goods_info;
|
|
|
+ },
|
|
|
//数量
|
|
|
async numberChange(data) {
|
|
|
- //number,index
|
|
|
this.number = data.number;
|
|
|
this.calcTotal();
|
|
|
},
|
|
|
+ makePhone(){
|
|
|
+ uni.makePhoneCall({
|
|
|
+ phoneNumber: this.info.shop_mobile
|
|
|
+ })
|
|
|
+ },
|
|
|
// 计算价格
|
|
|
calcTotal() {
|
|
|
- let price = 0;
|
|
|
- let number = 0; // 产品数量
|
|
|
-
|
|
|
- //计算出当前产品price,number
|
|
|
- this.price = price.toFixed(2);
|
|
|
- let total = price;
|
|
|
-
|
|
|
+ let price = parseFloat(this.info.shop_price).toFixed(2);
|
|
|
+ let number = this.number; // 产品数量
|
|
|
+ this.total = price * number;
|
|
|
+ this.realTotal = price * number;
|
|
|
// 检查当前优惠券是否满足使用条件
|
|
|
this.coupon_price = 0.0;
|
|
|
if (this.useCouponIndex != -1 && this.couponList && this.couponList[this.useCouponIndex]) {
|
|
|
- this.coupon_price = this.couponList[this.useCouponIndex].value;
|
|
|
- if (this.price >= this.couponList[this.useCouponIndex].least) {
|
|
|
- total = total - this.coupon_price;
|
|
|
+ this.coupon_price = this.couponList[this.useCouponIndex].money;
|
|
|
+ if (this.total >= this.couponList[this.useCouponIndex].min_money) {
|
|
|
+ this.realTotal = this.total - this.coupon_price;
|
|
|
} else {
|
|
|
this.$tools.msg('选中的优惠券不满足使用条件', 2000);
|
|
|
this.useCouponIndex = -1; //取消选中的优惠券
|
|
|
this.coupon_price = 0; //设置优惠金额为0
|
|
|
- total = total - this.coupon_price;
|
|
|
+ this.realTotal = this.total - this.coupon_price;
|
|
|
}
|
|
|
}
|
|
|
},
|
|
@@ -178,13 +219,46 @@ export default {
|
|
|
openTime(){
|
|
|
this.$refs.timeRef.open();
|
|
|
},
|
|
|
- showCoupons(){
|
|
|
+ async showCoupons(){
|
|
|
+ let sendData = {
|
|
|
+ shop_id: this.shopId,
|
|
|
+ total_amount: this.total,
|
|
|
+ }
|
|
|
+ let res = await this.$request('goods.shopCoupons',sendData);
|
|
|
+ this.couponList = res.data;
|
|
|
this.$refs.couponRef.show();
|
|
|
},
|
|
|
hideCoupons(){
|
|
|
this.$refs.couponRef.hide();
|
|
|
},
|
|
|
-
|
|
|
+ tapCoupon(idx){
|
|
|
+ this.hideCoupons();
|
|
|
+ if(idx === this.useCouponIndex){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.useCouponIndex = idx;
|
|
|
+ this.calcTotal();
|
|
|
+ },
|
|
|
+ async submit(){
|
|
|
+ if(!this.addrInfo.id){
|
|
|
+ this.$tools.msg('请选择您的地址')
|
|
|
+ return;
|
|
|
+ }else if(! this.show_time){
|
|
|
+ this.$tools.msg('请输入自提时间')
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ let sendData={
|
|
|
+ id:this.id,
|
|
|
+ shop_id:this.shopId,
|
|
|
+ buy_number: this.number,
|
|
|
+ self_hours:this.show_time,
|
|
|
+ coupon_id: this.useCouponIndex !== -1 ? this.couponList[this.useCouponIndex].id : '',
|
|
|
+ address_id: this.addrInfo.id,
|
|
|
+ remark: this.remark,
|
|
|
+ }
|
|
|
+ let res=await this.$request('order.add',sendData);
|
|
|
+ this.navTo('/pages/public/pay',{orderId:res.data.id})
|
|
|
+ },
|
|
|
}
|
|
|
};
|
|
|
</script>
|
|
@@ -307,6 +381,10 @@ page {
|
|
|
}
|
|
|
.group_13 {
|
|
|
padding: 40rpx 0;
|
|
|
+ border-bottom: 2rpx solid #eee;
|
|
|
+ &:last-child{
|
|
|
+ border: none;
|
|
|
+ }
|
|
|
}
|
|
|
.text_12 {
|
|
|
color: #333333;
|
|
@@ -319,6 +397,7 @@ page {
|
|
|
color: #999999;
|
|
|
font-size: 28rpx;
|
|
|
font-family: PingFang;
|
|
|
+ max-width: 400rpx;
|
|
|
&.active{
|
|
|
color: #333;
|
|
|
}
|
|
@@ -371,6 +450,9 @@ page {
|
|
|
font-size: 28rpx;
|
|
|
font-family: PingFang;
|
|
|
line-height: 26rpx;
|
|
|
+ &.active{
|
|
|
+ color: #ff342e;
|
|
|
+ }
|
|
|
}
|
|
|
.image_8 {
|
|
|
margin: 4rpx 0 4rpx 11rpx;
|
|
@@ -442,6 +524,9 @@ page {
|
|
|
border-radius: 38rpx;
|
|
|
width: 228rpx;
|
|
|
height: 76rpx;
|
|
|
+ &.disabled{
|
|
|
+ background-color: #eee;
|
|
|
+ }
|
|
|
}
|
|
|
.text_25 {
|
|
|
color: #ffffff;
|