You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
yanzong_qianduan/pages/sureOrder/index.vue

997 lines
20 KiB

<template>
<view class="sureOrder">
<view>
<u-navbar title="确认订单" back-icon-color="#fff" :border-bottom="false" title-color="#333"
:background="background"></u-navbar>
</view>
<view class="buyType">
<view class="toDoor" @click="choseType('sm')"
:style="{'background':buyType=='sm'?'#fff':'rgba(255, 255, 255, 0.57)','height':buyType=='zq'?'88rpx':'78rpx'}">
送货上门
</view>
<view class="bySelf" @click="choseType('zq')"
:style="{'background':buyType=='zq'?'#fff':'rgba(255, 255, 255, 0.57)','height':buyType=='zq'?'88rpx':'78rpx'}">
到店自取
</view>
</view>
<view class="address" v-if="buyType!='sm'">
<view class="addAddress">
请点击添加收货地址
</view>
<view class="leftImg">
<image src="/static/order/left.png" mode=""></image>
</view>
</view>
<view class="getSelf">
<view class="shopAddress" v-if="buyType=='zq'">
<view class="youTime">
花梨服务站
</view>
<view class="leftImg">
切换
<image src="/static/order/left.png" mode=""></image>
</view>
</view>
<view class="addressDetail">
{{addressInfo.name}} {{addressInfo.region.province +addressInfo.region.city+addressInfo.region.region}}
</view>
<view class="lookMap" v-if="buyType=='zq'">
<image src="/static/user/address.png" mode="" class="addressIcon"></image>
<view class="range">
距您16.39km
</view>
<view class="checkMap">
查看地图
</view>
<image src="/static/order/left.png" mode="" class="rightIcon"></image>
</view>
<view class="pickUp">
<view class="pickPeople">
<view class="title">
取件人
</view>
<view class="name">
{{addressInfo.name}}
</view>
</view>
<view class="pickPeople">
<view class="title">
</view>
<view class="name">
<image src="/static/order/edit.png" mode="" class="edit"></image>
</view>
</view>
<view class="pickPeople">
<view class="title">
预留电话
</view>
<view class="name">
{{addressInfo.phone}}
</view>
</view>
<view class="pickPeople">
<view class="title">
</view>
<view class="name">
<image src="/static/order/edit.png" mode="" class="edit"></image>
</view>
</view>
</view>
</view>
<view class="preTime">
<view class="left">
<view class="bagImg">
<image src="/static/order/bag.png" mode="" class="bag"></image>
街边取
</view>
<view class="preText">
如果您不方便只需要在街边稍候送到您的手上
</view>
</view>
<view class="switch">
<switch />
</view>
</view>
<!-- <view class="time">
<view class="youTime">
预计到货时间
</view>
<view class="leftImg">
<text class="leftText">2024-12-20 0930</text>
<image src="/static/order/left.png" mode=""></image>
</view>
</view> -->
<!-- <view class="time">
<view class="youTime">
您期待的收货时间
</view>
<view class="leftImg">
请选择
<image src="/static/order/left.png" mode=""></image>
</view>
</view> -->
<view class="goodsDetail">
<view class="goodsType">
<image src="/static/order/bag.png" mode="" class="bag"></image>
<text>大白兔家电</text>
<image src="/static/order/left.png" mode="" class="leftIcon"></image>
</view>
<view class="goods">
<view class="goodsImg">
<image :src="goodsInfo.goods_image" mode=""></image>
</view>
<view class="goodsInfo">
<view class="goodsName">
{{goodsInfo.goods_name}}
</view>
<view class="goodsPrice">
<text>{{goodsInfo.goods_price_min}}</text>
</view>
</view>
<view class="goodsNum">
x1
</view>
</view>
</view>
<view class="time">
<view class="youTime" style="width: 60rpx;">
留言
</view>
<input type="textarea" placeholder="建议留言前先和店家沟通" v-model="remark" style="width:100%;" maxlength="100" />
</view>
<view class="orderTips">
<view class="orderTitle">
<view class="total">
商品总额
</view>
<view class="price">
¥{{goodsInfo.goods_price_min}}
</view>
</view>
<view class="orderTitle">
<view class="total">
运费
</view>
<view class="price">
¥{{goodsInfo.goods_price_min}}
</view>
</view>
<view class="orderTitle">
<view class="total">
商品数量
</view>
<view class="price">
<text class="couponNum">1件</text>
</view>
</view>
<view class="orderTitle">
<view class="total">
优惠券
</view>
<view class="price" @click="choseCoupon">
<text class="couponNum">{{couponList.length}}张可用</text>
<image src="/static/order/left.png" mode=""></image>
</view>
</view>
<view class="line">
</view>
<view class="amount">
<view class="left">
</view>
<view class="right">
<text class="totalNum">共1件,合计:</text>
<text class="allPrice">¥{{goodsInfo.goods_price_min}}</text>
</view>
</view>
</view>
<view class="payType">
<view class="itemType">
<view class="payName">
<image src="/static/order/wChat.png" mode="" class="payIcon"></image>
微信支付
</view>
<image src="/static/order/right.png" mode="" class="chose"></image>
</view>
<view class="line">
</view>
<view class="itemType">
<view class="" v-for="(item,index) in payMethList" :key="index" @click="chosePayType(item)">
<view class="payName">
<image src="/static/order/friends.png" mode="" class="payIcon"></image>
余额支付
</view>
<image src="/static/order/right.png" mode="" class="chose" v-if="payType==item.method"></image>
</view>
</view>
<view class="line">
</view>
<!-- <view class="itemType">
<view class="payName">
<image src="/static/order/shop.png" mode="" class="payIcon"></image>
到店支付
</view>
</view> -->
</view>
<view class="footer">
<view class="meetPrice">
应付款
<text class="type">¥</text>
<text class="price">{{goodsInfo.goods_price_min}}</text>
</view>
<view class="btn" @click="orderPay">
提交订单
</view>
</view>
</view>
</template>
<script>
import * as order from '@/api/checkout.js'
// import img from "@/static/member/head.png"
import * as storeShop from '@/api/shop.js'
import * as address from '@/api/address.js'
import * as cashier from '@/api/cashier/index.js'
import * as CouponApi from '@/api/coupon'
import {
Wechat
} from '@/core/payment'
export default {
data() {
let img = 'https://www.saas.njrenzhou.com/static/member/head.png'
return {
remark: '',
payType: 'weChat',
buyType: 'sm',
background: {
background: 'url(' + img + ') center top no-repeat',
backgroundSize: '100% auto',
},
goodsInfo: {},
shopInfo: {},
addressList: [],
addressInfo: {},
payMethList: [],
orderID: '',
couponList: [],
}
},
onLoad(options) {
console.log(options, 'kkkkkk')
// if (options.goodsInfo) {
let goodsInfo = options.goodsID;
console.log(goodsInfo, '5555555', typeof(goodsInfo));
this.goodsInfo = JSON.parse(decodeURIComponent(goodsInfo))
console.log(this.goodsInfo, '666666');
// }
},
onShow() {
this.getShopInfo()
this.getAddressList();
this.orderSubmit()
this.getCoupon()
},
methods: {
getCoupon() {
const that =this
let param = {
dataType:'isUsable'
}
CouponApi.myCouponList(param)
.then(res => {
that.couponList = res.data.list.data
})
.finally()
},
choseCoupon() {
// 选择优惠券
uni.navigateTo({
url: '/pages/news/coupon/list?chose=true',
})
},
chosePayType(item) {
this.payType = item.method
},
choseType(val) {
this.buyType = val
},
getDefaultAddress() {
const that = this
return new Promise((resolve, reject) => {
address.defaultId().then(res => {
if (res.status == 200) {
for (var i = 0; i < that.addressList.length; i++) {
if (res.data.defaultId == that.addressList[i].address_id) {
that.addressInfo = that.addressList[i]
console.log(that.addressInfo, '获取收货地址')
}
}
}
})
.catch()
})
},
getAddressList() {
const that = this
return new Promise((resolve, reject) => {
address.list().then(res => {
if (res.status == 200) {
that.addressList = res.data.list
that.getDefaultAddress()
}
})
.catch()
})
},
getShopInfo() {
return new Promise((resolve, reject) => {
storeShop.list().then(res => {
console.log(res, '获取店铺信息')
})
.catch()
})
},
orderSubmit() {
const that = this;
console.log(that.goodsInfo, '55555')
let params = {
mode: 'buyNow',
delivery: '10',
couponId: '',
isUsePoints: 0,
remark: that.remark,
shopId: '',
linkman: '',
phone: '',
goodsId: that.goodsInfo.goods_id,
goodsNum: 1,
goodsSkuId: that.goodsInfo.skuList[0].goods_sku_id,
cartIds: ''
}
order.submit('buyNow', params)
.then(res => {
if (res.status == 200) {
that.orderId = res.data.orderId
that.getOrderInfoPay(res.data.orderId)
}
})
.catch()
},
getOrderInfoPay(val) {
cashier.orderInfo(val).then(res => {
if (res.status == 200) {
this.payMethList = res.data.paymentMethods
}
})
.catch()
},
onShowSuccess(res) {
this.$toast(message || '订单支付成功')
uni.navigateTo({
url: '/pages/news/recycling/orderList'
})
},
orderPay() {
const that = this
if (that.payType == 'balance') {
that.payBanlance()
return
}
cashier.orderPay(that.orderID).then(res => {
if (res.status == 200) {
let paymentData = res.data.payment
Wechat.payment({
orderKey: res.data.payment.out_trade_no,
...paymentData
})
.then((result) => {
console.log(result)
that.onShowSuccess(result)
})
.catch(err => {
console.log(err)
})
}
})
.catch()
},
payBanlance() {
const that = this
let params = {
extra: {},
method: 'balance',
client: 'weChat'
}
cashier.orderPay(that.orderID, params).then(res => {
that.$toast(res.message)
if (res.status == 200) {
setTimeout(() => {
uni.navigateTo({
url: '/pages/news/recycling/orderList'
})
}, 1000)
}
})
.catch()
},
// getOrderInfo() {
// const that = this
// let params = {
// orderId: 10202,
// client: 'wechat'
// }
// cashier.orderInfo(params)
// .then(res => {
// if (res.status == 200) {
// that.payOrderInfo()
// }
// })
// .catch()
// },
payOrderInfo() {
const that = this
let form = {
client: 'wechat',
method: 'wechat',
extra: {}
}
cashier.orderInfo(10202, form)
.then(res => {
if (res.status == 200) {
let paymentData = res.data.payment
Wechat.payment({
orderKey: res.data.payment.out_trade_no,
...paymentData
})
.then((result) => {
console.log(result)
})
.catch(err => {
console.log(err)
})
}
})
.catch()
},
},
}
</script>
<style lang="scss" scoped>
.sureOrder {
width: 750rpx;
padding-bottom: 120rpx;
background-image: url('https://www.saas.njrenzhou.com/static/home/homeback.png');
background-size: 100% 100%;
}
.buyType {
display: flex;
margin: 70rpx 0 0 26rpx;
.toDoor {
width: 348rpx;
height: 88rpx;
background-color: #fff;
font-size: 28rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 500;
color: #000000;
line-height: 88rpx;
text-align: center;
}
.bySelf {
width: 350rpx;
height: 74rpx;
background-color: rgba(255, 255, 255, 0.570000);
line-height: 74rpx;
text-align: center;
font-size: 24rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #606060;
line-height: 74rpx;
position: relative;
top: 14rpx;
}
}
.getSelf {
.shopAddress {
display: flex;
align-items: center;
justify-content: space-between;
.youTime {
font-size: 24rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #000000;
}
.leftImg {
font-size: 24rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #9E9E9E;
image {
width: 18rpx;
height: 18rpx;
margin-left: 16rpx;
}
}
}
margin-left: 26rpx;
background-image: url('../../static/order/map.png');
background-size: 100% 100%;
width: 694rpx;
height: 246rpx;
padding:14rpx 46rpx 0 32rpx;
.addressDetail {
height: 34rpx;
font-size: 24rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #838383;
line-height: 34rpx;
margin-top: 6rpx;
}
.lookMap {
display: flex;
align-items: center;
margin-top: 8rpx;
.addressIcon {
width: 23rpx;
height: 26rpx;
margin-right: 14rpx;
}
.range {
font-size: 20rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #F42B17;
line-height: 26rpx;
padding-right: 10rpx;
border-right: 2rpx solid #D9D9D9;
margin-right: 10rpx;
}
.checkMap {
font-size: 20rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #2B2B2B;
line-height: 26rpx;
margin-right: 24rpx;
}
.rightIcon {
width: 18rpx;
height: 18rpx;
}
}
.pickUp {
display: flex;
justify-content: space-around;
margin-top: 26rpx;
.pickPeople {
.title {
height: 28rpx;
font-size: 20rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #838383;
line-height: 28rpx;
}
.name {
height: 28rpx;
font-size: 20rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 600;
color: #2C2C2C;
line-height: 28rpx;
margin-top: 10rpx;
.edit {
width: 20rpx;
height: 20rpx;
}
}
}
}
}
.leftText {
font-size: 24rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #F21A1C;
line-height: 28rpx;
}
.address {
margin-left: 26rpx;
background-image: url('../../static/order/map.png');
width: 694rpx;
height: 154rpx;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 52rpx 0 32rpx;
.addAddress {
font-size: 28rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 500;
color: #F32E2E;
}
.leftImg {
width: 18rpx;
height: 18rpx;
image {
width: 100%;
height: 100%;
}
}
}
.preTime {
width: 694rpx;
height: 140rpx;
background: #FFFFFF;
border-radius: 10rpx 10rpx 10rpx 10rpx;
opacity: 1;
margin: 12rpx 0 0 26rpx;
display: flex;
justify-content: space-between;
padding: 34rpx 0 0 30rpx;
.left {
.bagImg {
height: 30rpx;
font-size: 24rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #000000;
line-height: 30rpx;
margin-bottom: 10rpx;
.bag {
width: 30rpx;
height: 30rpx;
}
}
}
.preText {
height: 34rpx;
font-size: 24rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #959595;
line-height: 34rpx;
}
}
.time {
display: flex;
width: 694rpx;
height: 90rpx;
background: #FFFFFF;
border-radius: 10rpx 10rpx 10rpx 10rpx;
opacity: 1;
margin: 12rpx 0 0 26rpx;
align-items: center;
justify-content: space-between;
padding: 0 32rpx 0 28rpx;
.youTime {
font-size: 24rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #000000;
}
.leftImg {
font-size: 24rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #9E9E9E;
image {
width: 18rpx;
height: 18rpx;
margin-left: 16rpx;
}
}
}
.goodsDetail {
width: 694rpx;
min-height: 266rpx;
background: #FFFFFF;
border-radius: 10rpx 10rpx 10rpx 10rpx;
opacity: 1;
margin: 12rpx 0 0 26rpx;
padding: 32rpx 24rpx 24rpx 12rpx;
.goodsType {
display: flex;
align-items: center;
font-size: 28rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 500;
color: #333333;
.bag {
width: 30rpx;
height: 30rpx;
margin-right: 20rpx;
}
.leftIcon {
width: 18rpx;
height: 18rpx;
margin-left: 20rpx;
}
}
.goods {
display: flex;
align-items: center;
margin-top: 28rpx;
.goodsImg {
width: 162rpx;
height: 148rpx;
border-radius: 0rpx 0rpx 0rpx 0rpx;
opacity: 1;
image {
width: 100%;
height: 100%;
}
}
.goodsInfo {
margin-left: 20rpx;
.goodsName {
min-height: 40rpx;
font-size: 28rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #1E1E1E;
line-height: 40rpx;
margin-bottom: 4rpx;
}
.goodsPrice {
height: 50rpx;
font-size: 24rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 600;
color: #F21A1C;
line-height: 50rpx;
text {
font-size: 36rpx;
}
}
}
.goodsNum {
font-size: 28rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 500;
color: #1E1E1E;
margin-left: 150rpx;
}
}
}
.orderTips {
width: 694rpx;
height: 342rpx;
background: #FFFFFF;
border-radius: 10rpx 10rpx 10rpx 10rpx;
opacity: 1;
margin: 12rpx 0 0 26rpx;
padding: 22rpx 36rpx 24rpx 24rpx;
.orderTitle {
margin-bottom: 24rpx;
display: flex;
justify-content: space-between;
height: 34rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #2D2D2D;
line-height: 34rpx;
.total {
font-size: 24rpx;
}
.price {
.couponNum {
font-size: 28rpx;
color: #F42B17;
}
font-size: 28rpx;
image {
width: 18rpx;
height: 18rpx;
margin-left: 18rpx;
}
}
}
.amount {
display: flex;
justify-content: space-between;
margin-top: 20rpx;
.left {
width: 20rpx;
height: 34rpx;
}
.right {
display: flex;
align-items: center;
.totalNum {
height: 34rpx;
font-size: 24rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #000000;
line-height: 34rpx;
}
.allPrice {
font-size: 28rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 600;
color: #F42B17;
line-height: 34rpx;
}
}
}
}
.line {
width: 100%;
height: 0rpx;
opacity: 1;
border: 2rpx solid #F1F1F1;
}
.payType {
width: 694rpx;
height: 270rpx;
background: #FFFFFF;
border-radius: 10rpx 10rpx 10rpx 10rpx;
opacity: 1;
margin: 12rpx 0 0rpx 26rpx;
padding: 24rpx 26rpx 0;
.line {
margin-bottom: 24rpx;
}
.itemType {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 28rpx;
.payName {
display: flex;
align-items: center;
height: 42rpx;
font-size: 24rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #000000;
line-height: 42rpx;
.payIcon {
width: 42rpx;
height: 42rpx;
margin-right: 16rpx;
}
}
.chose {
width: 34rpx;
height: 24rpx;
margin-right: 26rpx;
}
}
}
.footer {
width: 100%;
height: 120rpx;
position: fixed;
background-color: #FFF;
bottom: 0;
display: flex;
justify-content: space-between;
align-items: center;
.meetPrice {
margin-left: 26rpx;
font-size: 24rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #000000;
.type {
font-size: 24rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #F42B17;
margin-left: 12rpx;
}
.price {
font-size: 40rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 600;
color: #F42B17;
}
}
.btn {
width: 214rpx;
height: 74rpx;
background: linear-gradient(180deg, #FD5D06 0%, #F3211A 100%);
border-radius: 100rpx 100rpx 100rpx 100rpx;
opacity: 1;
text-align: center;
font-size: 28rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 500;
color: #FFFFFF;
line-height: 74rpx;
margin-right: 20rpx;
}
}
</style>