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

11 months ago
<template>
<view class="sureOrder">
<view>
<u-navbar title="确认订单" back-icon-color="#fff" :border-bottom="false" title-color="#333"
:background="background"></u-navbar>
11 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'}">
11 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'}">
11 months ago
到店自取
</view>
</view>
10 months ago
<view class="address" v-if="buyType!='sm'">
11 months ago
<view class="addAddress">
请点击添加收货地址
</view>
<view class="leftImg">
<image src="/static/order/left.png" mode=""></image>
11 months ago
</view>
</view>
<view class="getSelf">
10 months ago
<view class="shopAddress" v-if="buyType=='zq'">
11 months ago
<view class="youTime">
花梨服务站
</view>
<view class="leftImg">
切换
<image src="/static/order/left.png" mode=""></image>
11 months ago
</view>
</view>
<view class="addressDetail">
10 months ago
{{addressInfo.name}} {{addressInfo.region.province +addressInfo.region.city+addressInfo.region.region}}
11 months ago
</view>
10 months ago
<view class="lookMap" v-if="buyType=='zq'">
11 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}}
11 months ago
</view>
</view>
<view class="pickPeople">
<view class="title">
11 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}}
11 months ago
</view>
</view>
<view class="pickPeople">
<view class="title">
11 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>
11 months ago
<view class="preText">
如果您不方便只需要在街边稍候送到您的手上
</view>
</view>
<view class="switch">
<switch />
</view>
</view>
10 months ago
<!-- <view class="time">
11 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>
11 months ago
</view>
10 months ago
</view> -->
<!-- <view class="time">
11 months ago
<view class="youTime">
您期待的收货时间
</view>
<view class="leftImg">
请选择
<image src="/static/order/left.png" mode=""></image>
11 months ago
</view>
10 months ago
</view> -->
11 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>
11 months ago
</view>
<view class="goodsInfo">
<view class="goodsName">
10 months ago
{{goodsInfo.goods_name}}
11 months ago
</view>
<view class="goodsPrice">
10 months ago
<text>{{goodsInfo.goods_price_min}}</text>
11 months ago
</view>
</view>
<view class="goodsNum">
x1
</view>
</view>
</view>
<view class="time">
10 months ago
<view class="youTime" style="width: 60rpx;">
11 months ago
留言
10 months ago
11 months ago
</view>
10 months ago
<input type="textarea" placeholder="建议留言前先和店家沟通" v-model="remark" style="width:100%;" maxlength="100" />
11 months ago
</view>
<view class="orderTips">
<view class="orderTitle">
<view class="total">
商品总额
</view>
<view class="price">
10 months ago
{{goodsInfo.goods_price_min}}
11 months ago
</view>
</view>
<view class="orderTitle">
<view class="total">
运费
</view>
<view class="price">
10 months ago
{{goodsInfo.goods_price_min}}
11 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>
11 months ago
<image src="/static/order/left.png" mode=""></image>
</view>
</view>
<view class="line">
11 months ago
</view>
<view class="amount">
<view class="left">
11 months ago
</view>
<view class="right">
<text class="totalNum">共1件合计</text>
10 months ago
<text class="allPrice">{{goodsInfo.goods_price_min}}</text>
11 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">
11 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>
11 months ago
</view>
</view>
<view class="line">
11 months ago
</view>
10 months ago
<!-- <view class="itemType">
11 months ago
<view class="payName">
<image src="/static/order/shop.png" mode="" class="payIcon"></image>
到店支付
</view>
10 months ago
</view> -->
11 months ago
</view>
<view class="footer">
<view class="meetPrice">
应付款
<text class="type"></text>
10 months ago
<text class="price">{{goodsInfo.goods_price_min}}</text>
11 months ago
</view>
10 months ago
<view class="btn" @click="orderPay">
11 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() {
10 months ago
let img = 'https://www.saas.njrenzhou.com/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: [],
11 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
}
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) {
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()
},
},
11 months ago
}
</script>
<style lang="scss" scoped>
.sureOrder {
11 months ago
width: 750rpx;
padding-bottom: 120rpx;
10 months ago
background-image: url('https://www.saas.njrenzhou.com/static/home/homeback.png');
11 months ago
background-size: 100% 100%;
}
.buyType {
11 months ago
display: flex;
margin: 70rpx 0 0 26rpx;
.toDoor {
11 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;
11 months ago
height: 74rpx;
background-color: rgba(255, 255, 255, 0.570000);
11 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 {
11 months ago
display: flex;
align-items: center;
justify-content: space-between;
.youTime {
11 months ago
font-size: 24rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #000000;
}
.leftImg {
11 months ago
font-size: 24rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #9E9E9E;
image {
11 months ago
width: 18rpx;
height: 18rpx;
margin-left: 16rpx;
}
}
}
11 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 {
11 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 {
11 months ago
display: flex;
align-items: center;
margin-top: 8rpx;
.addressIcon {
width: 23rpx;
11 months ago
height: 26rpx;
margin-right: 14rpx;
}
.range {
11 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;
11 months ago
margin-right: 10rpx;
}
.checkMap {
11 months ago
font-size: 20rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #2B2B2B;
line-height: 26rpx;
margin-right: 24rpx;
}
.rightIcon {
11 months ago
width: 18rpx;
height: 18rpx;
}
}
.pickUp {
11 months ago
display: flex;
justify-content: space-around;
margin-top: 26rpx;
.pickPeople {
.title {
11 months ago
height: 28rpx;
font-size: 20rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #838383;
line-height: 28rpx;
}
.name {
11 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 {
11 months ago
width: 20rpx;
height: 20rpx;
}
}
}
}
}
.leftText {
11 months ago
font-size: 24rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #F21A1C;
line-height: 28rpx;
}
.address {
11 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 {
11 months ago
font-size: 28rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 500;
color: #F32E2E;
}
.leftImg {
11 months ago
width: 18rpx;
height: 18rpx;
image {
11 months ago
width: 100%;
height: 100%;
}
}
}
.preTime {
11 months ago
width: 694rpx;
height: 140rpx;
background: #FFFFFF;
border-radius: 10rpx 10rpx 10rpx 10rpx;
opacity: 1;
margin: 12rpx 0 0 26rpx;
11 months ago
display: flex;
justify-content: space-between;
padding: 34rpx 0 0 30rpx;
.left {
.bagImg {
11 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 {
11 months ago
width: 30rpx;
height: 30rpx;
}
}
11 months ago
}
.preText {
11 months ago
height: 34rpx;
font-size: 24rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #959595;
line-height: 34rpx;
}
}
.time {
11 months ago
display: flex;
width: 694rpx;
height: 90rpx;
background: #FFFFFF;
border-radius: 10rpx 10rpx 10rpx 10rpx;
opacity: 1;
margin: 12rpx 0 0 26rpx;
11 months ago
align-items: center;
justify-content: space-between;
padding: 0 32rpx 0 28rpx;
.youTime {
11 months ago
font-size: 24rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #000000;
}
.leftImg {
11 months ago
font-size: 24rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #9E9E9E;
image {
11 months ago
width: 18rpx;
height: 18rpx;
margin-left: 16rpx;
}
}
}
.goodsDetail {
11 months ago
width: 694rpx;
10 months ago
min-height: 266rpx;
11 months ago
background: #FFFFFF;
border-radius: 10rpx 10rpx 10rpx 10rpx;
opacity: 1;
margin: 12rpx 0 0 26rpx;
padding: 32rpx 24rpx 24rpx 12rpx;
.goodsType {
11 months ago
display: flex;
align-items: center;
font-size: 28rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 500;
color: #333333;
.bag {
11 months ago
width: 30rpx;
height: 30rpx;
margin-right: 20rpx;
}
.leftIcon {
11 months ago
width: 18rpx;
height: 18rpx;
margin-left: 20rpx;
}
}
.goods {
11 months ago
display: flex;
align-items: center;
margin-top: 28rpx;
.goodsImg {
11 months ago
width: 162rpx;
height: 148rpx;
border-radius: 0rpx 0rpx 0rpx 0rpx;
opacity: 1;
image {
11 months ago
width: 100%;
height: 100%;
}
}
.goodsInfo {
11 months ago
margin-left: 20rpx;
.goodsName {
10 months ago
min-height: 40rpx;
11 months ago
font-size: 28rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #1E1E1E;
line-height: 40rpx;
margin-bottom: 4rpx;
}
.goodsPrice {
11 months ago
height: 50rpx;
font-size: 24rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 600;
color: #F21A1C;
line-height: 50rpx;
text {
11 months ago
font-size: 36rpx;
}
}
}
.goodsNum {
11 months ago
font-size: 28rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 500;
color: #1E1E1E;
margin-left: 150rpx;
}
}
}
.orderTips {
11 months ago
width: 694rpx;
height: 342rpx;
background: #FFFFFF;
border-radius: 10rpx 10rpx 10rpx 10rpx;
opacity: 1;
margin: 12rpx 0 0 26rpx;
11 months ago
padding: 22rpx 36rpx 24rpx 24rpx;
.orderTitle {
11 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 {
11 months ago
font-size: 24rpx;
}
.price {
.couponNum {
11 months ago
font-size: 28rpx;
color: #F42B17;
}
11 months ago
font-size: 28rpx;
image {
11 months ago
width: 18rpx;
height: 18rpx;
margin-left: 18rpx;
}
}
}
.amount {
11 months ago
display: flex;
justify-content: space-between;
margin-top: 20rpx;
.left {
11 months ago
width: 20rpx;
height: 34rpx;
}
.right {
11 months ago
display: flex;
align-items: center;
.totalNum {
11 months ago
height: 34rpx;
font-size: 24rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #000000;
line-height: 34rpx;
}
.allPrice {
11 months ago
font-size: 28rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 600;
color: #F42B17;
line-height: 34rpx;
11 months ago
}
}
}
}
.line {
11 months ago
width: 100%;
height: 0rpx;
opacity: 1;
border: 2rpx solid #F1F1F1;
}
.payType {
11 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 {
11 months ago
margin-bottom: 24rpx;
}
.itemType {
11 months ago
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 28rpx;
.payName {
11 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 {
11 months ago
width: 42rpx;
height: 42rpx;
margin-right: 16rpx;
}
}
.chose {
11 months ago
width: 34rpx;
height: 24rpx;
margin-right: 26rpx;
}
}
}
.footer {
11 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;
11 months ago
font-size: 24rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #000000;
.type {
11 months ago
font-size: 24rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #F42B17;
margin-left: 12rpx;
}
.price {
11 months ago
font-size: 40rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 600;
color: #F42B17;
}
}
.btn {
11 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>