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

10 months ago
<template>
<view class="sureOrder">
<view>
<u-navbar title="确认订单" back-icon-color="#fff" :border-bottom="false" title-color="#333"
:background="background"></u-navbar>
10 months ago
</view>
<view class="buyType">
10 months ago
<view class="toDoor" @click="choseType('sm')"
:style="{'background':buyType=='sm'?'#fff':'rgba(255, 255, 255, 0.57)','height':buyType=='zq'?'88rpx':'78rpx'}">
10 months ago
送货上门
</view>
10 months ago
<view class="bySelf" @click="choseType('zq')"
:style="{'background':buyType=='zq'?'#fff':'rgba(255, 255, 255, 0.57)','height':buyType=='zq'?'88rpx':'78rpx'}">
10 months ago
到店自取
</view>
</view>
10 months ago
<view class="address" v-if="buyType!='sm'">
10 months ago
<view class="addAddress">
请点击添加收货地址
</view>
<view class="leftImg">
<image src="/static/order/left.png" mode=""></image>
10 months ago
</view>
</view>
<view class="getSelf">
10 months ago
<view class="shopAddress" v-if="buyType=='zq'">
10 months ago
<view class="youTime">
花梨服务站
</view>
<view class="leftImg">
切换
<image src="/static/order/left.png" mode=""></image>
10 months ago
</view>
</view>
<view class="addressDetail">
10 months ago
{{addressInfo.name}} {{addressInfo.region.province +addressInfo.region.city+addressInfo.region.region}}
10 months ago
</view>
10 months ago
<view class="lookMap" v-if="buyType=='zq'">
10 months ago
<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}}
10 months ago
</view>
</view>
<view class="pickPeople">
<view class="title">
10 months ago
</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}}
10 months ago
</view>
</view>
<view class="pickPeople">
<view class="title">
10 months ago
</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>
10 months ago
<view class="preText">
如果您不方便只需要在街边稍候送到您的手上
</view>
</view>
<view class="switch">
<switch />
</view>
</view>
10 months ago
<!-- <view class="time">
10 months ago
<view class="youTime">
预计到货时间
</view>
<view class="leftImg">
<text class="leftText">2024-12-20 0930</text>
<image src="/static/order/left.png" mode=""></image>
10 months ago
</view>
10 months ago
</view> -->
<!-- <view class="time">
10 months ago
<view class="youTime">
您期待的收货时间
</view>
<view class="leftImg">
请选择
<image src="/static/order/left.png" mode=""></image>
10 months ago
</view>
10 months ago
</view> -->
10 months ago
<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">
10 months ago
<image :src="goodsInfo.goods_image" mode=""></image>
10 months ago
</view>
<view class="goodsInfo">
<view class="goodsName">
10 months ago
{{goodsInfo.goods_name}}
10 months ago
</view>
<view class="goodsPrice">
10 months ago
<text>{{goodsInfo.goods_price_min}}</text>
10 months ago
</view>
</view>
<view class="goodsNum">
x1
</view>
</view>
</view>
<view class="time">
10 months ago
<view class="youTime" style="width: 60rpx;">
10 months ago
留言
10 months ago
10 months ago
</view>
10 months ago
<input type="textarea" placeholder="建议留言前先和店家沟通" v-model="remark" style="width:100%;" maxlength="100" />
10 months ago
</view>
<view class="orderTips">
<view class="orderTitle">
<view class="total">
商品总额
</view>
<view class="price">
10 months ago
{{goodsInfo.goods_price_min}}
10 months ago
</view>
</view>
<view class="orderTitle">
<view class="total">
运费
</view>
<view class="price">
10 months ago
{{goodsInfo.goods_price_min}}
10 months ago
</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>
10 months ago
<view class="price" @click="choseCoupon">
<text class="couponNum">{{couponList.length}}张可用</text>
10 months ago
<image src="/static/order/left.png" mode=""></image>
</view>
</view>
<view class="line">
10 months ago
</view>
<view class="amount">
<view class="left">
10 months ago
</view>
<view class="right">
<text class="totalNum">共1件合计</text>
10 months ago
<text class="allPrice">{{goodsInfo.goods_price_min}}</text>
10 months ago
</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">
10 months ago
</view>
<view class="itemType">
10 months ago
<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>
10 months ago
</view>
</view>
<view class="line">
10 months ago
</view>
10 months ago
<!-- <view class="itemType">
10 months ago
<view class="payName">
<image src="/static/order/shop.png" mode="" class="payIcon"></image>
到店支付
</view>
10 months ago
</view> -->
10 months ago
</view>
<view class="footer">
<view class="meetPrice">
应付款
<text class="type"></text>
10 months ago
<text class="price">{{goodsInfo.goods_price_min}}</text>
10 months ago
</view>
10 months ago
<view class="btn" @click="orderPay">
10 months ago
提交订单
</view>
</view>
</view>
</template>
<script>
import * as order from '@/api/checkout.js'
10 months ago
// import img from "@/static/member/head.png"
import * as storeShop from '@/api/shop.js'
import * as address from '@/api/address.js'
10 months ago
import * as cashier from '@/api/cashier/index.js'
import * as CouponApi from '@/api/coupon'
import {
Wechat
} from '@/core/payment'
export default {
data() {
9 months ago
let img = 'https://www.royaum.com.cn/static/member/head.png'
return {
10 months ago
remark: '',
payType: 'weChat',
10 months ago
buyType: 'sm',
10 months ago
background: {
background: 'url(' + img + ') center top no-repeat',
10 months ago
backgroundSize: '100% auto',
},
goodsInfo: {},
10 months ago
shopInfo: {},
addressList: [],
10 months ago
addressInfo: {},
payMethList: [],
orderID: '',
couponList: [],
10 months ago
}
},
onLoad(options) {
10 months ago
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() {
10 months ago
this.getShopInfo()
this.getAddressList();
10 months ago
this.orderSubmit()
this.getCoupon()
10 months ago
},
methods: {
10 months ago
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
},
10 months ago
choseType(val) {
this.buyType = val
},
getDefaultAddress() {
10 months ago
const that = this
return new Promise((resolve, reject) => {
address.defaultId().then(res => {
10 months ago
if (res.status == 200) {
10 months ago
for (var i = 0; i < that.addressList.length; i++) {
if (res.data.defaultId == that.addressList[i].address_id) {
that.addressInfo = that.addressList[i]
10 months ago
console.log(that.addressInfo, '获取收货地址')
}
}
}
})
.catch()
})
},
10 months ago
getAddressList() {
const that = this
return new Promise((resolve, reject) => {
address.list().then(res => {
10 months ago
if (res.status == 200) {
that.addressList = res.data.list
that.getDefaultAddress()
}
})
.catch()
})
},
10 months ago
getShopInfo() {
return new Promise((resolve, reject) => {
storeShop.list().then(res => {
10 months ago
console.log(res, '获取店铺信息')
})
.catch()
})
10 months ago
},
orderSubmit() {
10 months ago
const that = this;
console.log(that.goodsInfo, '55555')
let params = {
10 months ago
mode: 'buyNow',
delivery: '10',
couponId: '',
isUsePoints: 0,
10 months ago
remark: that.remark,
shopId: '',
10 months ago
linkman: '',
phone: '',
goodsId: that.goodsInfo.goods_id,
goodsNum: 1,
10 months ago
goodsSkuId: that.goodsInfo.skuList[0].goods_sku_id,
cartIds: ''
}
10 months ago
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
}
9 months ago
cashier.orderPay(that.orderId).then(res => {
10 months ago
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) {
10 months ago
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()
},
},
10 months ago
}
</script>
<style lang="scss" scoped>
.sureOrder {
10 months ago
width: 750rpx;
padding-bottom: 120rpx;
9 months ago
background-image: url('https://www.royaum.com.cn/static/home/homeback.png');
10 months ago
background-size: 100% 100%;
}
.buyType {
10 months ago
display: flex;
margin: 70rpx 0 0 26rpx;
.toDoor {
10 months ago
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;
10 months ago
height: 74rpx;
background-color: rgba(255, 255, 255, 0.570000);
10 months ago
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 {
10 months ago
display: flex;
align-items: center;
justify-content: space-between;
.youTime {
10 months ago
font-size: 24rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #000000;
}
.leftImg {
10 months ago
font-size: 24rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #9E9E9E;
image {
10 months ago
width: 18rpx;
height: 18rpx;
margin-left: 16rpx;
}
}
}
10 months ago
margin-left: 26rpx;
background-image: url('../../static/order/map.png');
background-size: 100% 100%;
width: 694rpx;
height: 246rpx;
padding:14rpx 46rpx 0 32rpx;
.addressDetail {
10 months ago
height: 34rpx;
font-size: 24rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #838383;
line-height: 34rpx;
margin-top: 6rpx;
}
.lookMap {
10 months ago
display: flex;
align-items: center;
margin-top: 8rpx;
.addressIcon {
width: 23rpx;
10 months ago
height: 26rpx;
margin-right: 14rpx;
}
.range {
10 months ago
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;
10 months ago
margin-right: 10rpx;
}
.checkMap {
10 months ago
font-size: 20rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #2B2B2B;
line-height: 26rpx;
margin-right: 24rpx;
}
.rightIcon {
10 months ago
width: 18rpx;
height: 18rpx;
}
}
.pickUp {
10 months ago
display: flex;
justify-content: space-around;
margin-top: 26rpx;
.pickPeople {
.title {
10 months ago
height: 28rpx;
font-size: 20rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #838383;
line-height: 28rpx;
}
.name {
10 months ago
height: 28rpx;
font-size: 20rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 600;
color: #2C2C2C;
line-height: 28rpx;
margin-top: 10rpx;
.edit {
10 months ago
width: 20rpx;
height: 20rpx;
}
}
}
}
}
.leftText {
10 months ago
font-size: 24rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #F21A1C;
line-height: 28rpx;
}
.address {
10 months ago
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 {
10 months ago
font-size: 28rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 500;
color: #F32E2E;
}
.leftImg {
10 months ago
width: 18rpx;
height: 18rpx;
image {
10 months ago
width: 100%;
height: 100%;
}
}
}
.preTime {
10 months ago
width: 694rpx;
height: 140rpx;
background: #FFFFFF;
border-radius: 10rpx 10rpx 10rpx 10rpx;
opacity: 1;
margin: 12rpx 0 0 26rpx;
10 months ago
display: flex;
justify-content: space-between;
padding: 34rpx 0 0 30rpx;
.left {
.bagImg {
10 months ago
height: 30rpx;
font-size: 24rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #000000;
line-height: 30rpx;
margin-bottom: 10rpx;
.bag {
10 months ago
width: 30rpx;
height: 30rpx;
}
}
10 months ago
}
.preText {
10 months ago
height: 34rpx;
font-size: 24rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #959595;
line-height: 34rpx;
}
}
.time {
10 months ago
display: flex;
width: 694rpx;
height: 90rpx;
background: #FFFFFF;
border-radius: 10rpx 10rpx 10rpx 10rpx;
opacity: 1;
margin: 12rpx 0 0 26rpx;
10 months ago
align-items: center;
justify-content: space-between;
padding: 0 32rpx 0 28rpx;
.youTime {
10 months ago
font-size: 24rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #000000;
}
.leftImg {
10 months ago
font-size: 24rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #9E9E9E;
image {
10 months ago
width: 18rpx;
height: 18rpx;
margin-left: 16rpx;
}
}
}
.goodsDetail {
10 months ago
width: 694rpx;
10 months ago
min-height: 266rpx;
10 months ago
background: #FFFFFF;
border-radius: 10rpx 10rpx 10rpx 10rpx;
opacity: 1;
margin: 12rpx 0 0 26rpx;
padding: 32rpx 24rpx 24rpx 12rpx;
.goodsType {
10 months ago
display: flex;
align-items: center;
font-size: 28rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 500;
color: #333333;
.bag {
10 months ago
width: 30rpx;
height: 30rpx;
margin-right: 20rpx;
}
.leftIcon {
10 months ago
width: 18rpx;
height: 18rpx;
margin-left: 20rpx;
}
}
.goods {
10 months ago
display: flex;
align-items: center;
margin-top: 28rpx;
.goodsImg {
10 months ago
width: 162rpx;
height: 148rpx;
border-radius: 0rpx 0rpx 0rpx 0rpx;
opacity: 1;
image {
10 months ago
width: 100%;
height: 100%;
}
}
.goodsInfo {
10 months ago
margin-left: 20rpx;
.goodsName {
10 months ago
min-height: 40rpx;
10 months ago
font-size: 28rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #1E1E1E;
line-height: 40rpx;
margin-bottom: 4rpx;
}
.goodsPrice {
10 months ago
height: 50rpx;
font-size: 24rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 600;
color: #F21A1C;
line-height: 50rpx;
text {
10 months ago
font-size: 36rpx;
}
}
}
.goodsNum {
10 months ago
font-size: 28rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 500;
color: #1E1E1E;
margin-left: 150rpx;
}
}
}
.orderTips {
10 months ago
width: 694rpx;
height: 342rpx;
background: #FFFFFF;
border-radius: 10rpx 10rpx 10rpx 10rpx;
opacity: 1;
margin: 12rpx 0 0 26rpx;
10 months ago
padding: 22rpx 36rpx 24rpx 24rpx;
.orderTitle {
10 months ago
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 {
10 months ago
font-size: 24rpx;
}
.price {
.couponNum {
10 months ago
font-size: 28rpx;
color: #F42B17;
}
10 months ago
font-size: 28rpx;
image {
10 months ago
width: 18rpx;
height: 18rpx;
margin-left: 18rpx;
}
}
}
.amount {
10 months ago
display: flex;
justify-content: space-between;
margin-top: 20rpx;
.left {
10 months ago
width: 20rpx;
height: 34rpx;
}
.right {
10 months ago
display: flex;
align-items: center;
.totalNum {
10 months ago
height: 34rpx;
font-size: 24rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #000000;
line-height: 34rpx;
}
.allPrice {
10 months ago
font-size: 28rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 600;
color: #F42B17;
line-height: 34rpx;
10 months ago
}
}
}
}
.line {
10 months ago
width: 100%;
height: 0rpx;
opacity: 1;
border: 2rpx solid #F1F1F1;
}
.payType {
10 months ago
width: 694rpx;
height: 270rpx;
background: #FFFFFF;
border-radius: 10rpx 10rpx 10rpx 10rpx;
opacity: 1;
margin: 12rpx 0 0rpx 26rpx;
padding: 24rpx 26rpx 0;
.line {
10 months ago
margin-bottom: 24rpx;
}
.itemType {
10 months ago
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 28rpx;
.payName {
10 months ago
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 {
10 months ago
width: 42rpx;
height: 42rpx;
margin-right: 16rpx;
}
}
.chose {
10 months ago
width: 34rpx;
height: 24rpx;
margin-right: 26rpx;
}
}
}
.footer {
10 months ago
width: 100%;
height: 120rpx;
position: fixed;
background-color: #FFF;
bottom: 0;
display: flex;
justify-content: space-between;
align-items: center;
.meetPrice {
margin-left: 26rpx;
10 months ago
font-size: 24rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #000000;
.type {
10 months ago
font-size: 24rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #F42B17;
margin-left: 12rpx;
}
.price {
10 months ago
font-size: 40rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 600;
color: #F42B17;
}
}
.btn {
10 months ago
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>