yurong/.svn/pristine/bc/bcb49db9b054088c94b906a5281...

243 lines
7.7 KiB
Plaintext

<template>
<view class="pt-20">
<!-- 地址 -->
<view @tap="addressTap()" class="br-20 w-710 ml-20 mb-20 bgff relative zi-1" style="padding: 34rpx;">
<view class="rows rowsm">
<view class="rows rowsm f-1 mr-20"><image src="/static/index/weihijia.png" class="w-46 h-46"></view>
<view class="fs-26 col333 pr-30 f-12">
<view v-if="address&&address.id" class="">
<view class="mb-14">
<text class="mr-30 col333 fs-30">{{ address.consignee }}</text>
<text class="fs-26 col666">{{ address.contact }}</text>
</view>
<view class="two_overflow fs-28 col333">
{{ address.location }} {{ address.detailed_address }}
</view>
</view>
<view class="fs-26 col333 pr-60" v-else>新增地址</view>
</view>
<uni-icons type="right" color="#999"></uni-icons>
</view>
</view>
<!-- <view class="w-750 h-10 bgf5"></view> -->
<view class="w-710 ml-20">
<!-- 商品信息 -->
<view class="mb-20 br-20 bgff">
<view class="pl-40 pr-40 pt-25 ">
<view class="rows">
<image :src="URL + shopDet.image" class="w-172 h-172 br-10 mr-20 bg002fa7"></image>
<view class="rowsal" style="width: 100%;">
<view class="fs-26 mt-8 two_overflow">{{shopDet.name || '商品名称'}}</view>
<view class="rowsb rowsm mb-8">
<view class="fs-20 pl-10 pr-10 tct col999">{{ specInfo.attr.join(',') || '' }}x{{ parmas.num || 0 }}</view>
<view class="fs-30 ml-15 rowsce" style="color: #FF4600;">{{ shopPrice }}</view>
</view>
</view>
</view>
</view>
<view class="bgff pt-40">
<!-- 优惠券 -->
<view @tap="toCoupon()" class=" pr-40 pl-40 col333 fs-28 rowsb mt-30 pb-30" style="border-bottom: 1rpx solid #ececec;">
<text>采购券</text>
<text class="rows rowsm fs-24">
<text>{{onCoupon && onCoupon.id ? `满${onCoupon.use_min_price}减${onCoupon.coupon_price}元` : '暂无采购券'}} </text>
<uni-icons type="right" color="#c1c1c1"></uni-icons>
</text>
</view>
<!-- 运费 -->
<view class="w-670 pr-40 ml-40 h-103 col333 fs-24 rowse rowsm">
<view class="mt-10 mr-20">共计商品{{ parmas.num }}件</view>
<view class="rows">
<text class="mt-14">合计:</text>
<view class="fs-28">
<text class="">¥</text>
<text class="fs-40">{{ Number(parmas.num * specInfo.price) }}</text>
</view>
</view>
</view>
</view>
</view>
<view class="bgff mt-20 p-all-24 br-20">
<view class="mb-20 fs-28">订单备注</view>
<textarea placeholder="请输入备注信息" class="w100 h-200 br-20 p-all-20 fs-28 " style="background: #f8f8f8;"></textarea>
</view>
<view class="bgff mt-20 p-all-26 br-20">
<radio-group @change="swtichPay">
<label v-if="shopType == 3" class="rowsb rowsm">
<view class="rows rowsm">
<image src="/static/index/gouwuwquand.png" class="w-54 h-54"></image>
<view class="fs-28 col333 ml-16">购物券</view>
</view>
<radio value="1" :checked="parmas.pay_type==1" color="#22cfa2" style="transform: scale(.8);"></radio>
</label>
<label v-if="shopType == 3" class="rowsb rowsm mt-46">
<view class="rows rowsm">
<image src="/static/index/yuehid.png" class="w-54 h-54"></image>
<view class="fs-28 col333 ml-16">余额支付</view>
</view>
<radio value="2" :checked="parmas.pay_type==2" color="#22cfa2" style="transform: scale(.8);"></radio>
</label>
<label class="rowsb rowsm mt-46">
<view class="rows rowsm">
<image src="/static/index/fguiasd.png" class="w-54 h-54"></image>
<view class="fs-28 col333 ml-16">微信支付</view>
</view>
<radio value="3" :checked="parmas.pay_type==3" color="#22cfa2" style="transform: scale(.8);"></radio>
</label>
<label class="rowsb rowsm mt-46">
<view class="rows rowsm">
<image src="/static/index/zhifub.png" class="w-54 h-54"></image>
<view class="fs-28 col333 ml-16">支付宝</view>
</view>
<radio value="4" :checked="parmas.pay_type==4" color="#22cfa2" style="transform: scale(.8);"></radio>
</label>
</radio-group>
</view>
</view>
<view class="w-750 h-134 lh-134 pl-20 pr-20 bgff fixed" style="bottom: 0;">
<view class="rowsb rowsm">
<view class="rows mr-20 fs-28">
<text class="">合计:</text>
<text class=" col_FF0000">
<text class="mr-10">¥</text>
<text class="fs-40">{{ aumont }}</text>
</text>
<!-- <text class="fw-600 fn-kt fs-34">{{ aumont }}</text> -->
</view>
<view @tap="onCommit()" class="br-4 w-336 h-94 lh-94 br-50 fs-30 colfff tct bg">立即支付</view>
</view>
</view>
<view class="w-750 h-108"></view>
</view>
</template>
<script>
const app = getApp().globalData
export default {
data() {
return {
address: {},
parmas: {
pay_type: 3
},
onCoupon: {},
system: {},
shopType: 1,
specInfo: {},//规格信息
shopDet: {//商品详情
good_info:{
imgs: [],
spec:{
arr_info:[{stock:''}],
arr_group:[],
},
},
},
}
},
onShow() {
if (app.onAddress && app.onAddress.id) {
this.address = app.onAddress
}
this.onCoupon = app.onCoupon || {}
},
onLoad(option) {
this.shopDet = app.orderShop
this.specInfo = app.specInfo
this.shopType = option.type || 1
this.getAddress()
this.parmas.num = option.num
this.parmas.sku_id = this.specInfo.id
console.log(this.specInfo,this.shopDet,this.parmas,'当前参数')
},
computed: {
aumont() {//总价
// let num1 = this.isRemote?Number(this.system.postage_price):Number(this.system.order_postage)
let total = Number(this.parmas.num * this.specInfo.price)
let yun = 0
let couponMoney = Number(this.onCoupon.coupon_price) || ''
let money = (total + yun) - couponMoney
money = money.toFixed(2);
return money
},
shopPrice() {//商品价格
return '¥' + this.specInfo.price
}
},
methods: {
swtichPay(e) {//切换支付方式
this.parmas.pay_type = e.detail.value
},
//跳转提交订单页面
onCommit() {
if (!this.address.id) return this.showtt('请选择收货地址')
this.parmas.address_id = this.address.id
this.parmas.order_type = this.shopType
// this.parmas.coupon_id = this.onCoupon.id || ''
// this.parmas.is_coupon = Number(Boolean(this.onCoupon.id))
this.$tools.axiosFromToken('POST','platform_order/place',this.parmas,'正在提交订单').then(res => {
if (res.code == 1) {
this.winxinPay(res.data.id)
} else {
this.showtt(res.msg)
}
})
},
//请求支付参数
winxinPay(id) {
this.$tools.axiosFromToken('POST','platform_order/placePay',{
orderno: id
}).then(res => {
if (res.code != 1) return this.showtt(res.msg)
if (res.data) {
getApp().payFn('wxpay', res.data).then(res => {
this.payOver()
})
} else {
this.payOver()
}
})
},
payOver() {//支付完成
this.showtt('支付成功!')
setTimeout(function() {
uni.navigateBack({
delta: 1
});
}, 450);
},
//跳转优惠券
toCoupon() {
this.goNext(`/pages/me/couponList/couponList?type=2&aumont=${this.aumont }`)
},
//跳转地址管理页面
addressTap() {
this.goNext('/pages/me/pagesOne/address/addresslist/addresslist?select=1')
},
//获取地址列表
getAddress() {
this.$tools.axiosFromToken('POST','address/getDefaultAddress',{
token: app.token
}).then(res => {
if (res.data && res.data.id) {
this.address = res.data
}
})
}
},
onUnload() {
app.onCoupon = {}
app.onAddress = {}
},
}
</script>
<style>
page {
background: #fbfbfa;
}
</style>