feat:优惠券
This commit is contained in:
@@ -1,33 +1,18 @@
|
||||
<template>
|
||||
<view class="order_submit_warp">
|
||||
<Header
|
||||
:leftTitle="$t('order.submit.title')"
|
||||
leftPathType="switchTab"
|
||||
leftPath="/pages/shopping_cart/shopping_cart"
|
||||
/>
|
||||
<Header :leftTitle="$t('order.submit.title')" leftPathType="switchTab"
|
||||
leftPath="/pages/shopping_cart/shopping_cart" />
|
||||
<!-- 收件人信息 -->
|
||||
<view
|
||||
class="order_submit_header_warp"
|
||||
@click="checkAddressShow(true, 'data')"
|
||||
v-if="orderInfo.address && Object.keys(orderInfo.address).length !== 0"
|
||||
>
|
||||
<view class="order_submit_header_warp" @click="checkAddressShow(true, 'data')"
|
||||
v-if="orderInfo.address && Object.keys(orderInfo.address).length !== 0">
|
||||
<view class="header_areaAddress_warp">
|
||||
<view
|
||||
class="tab-comm areaAddress_default"
|
||||
v-if="orderInfo.address.isDefault"
|
||||
>默认</view
|
||||
>
|
||||
<view class="tab-comm areaAddress_default" v-if="orderInfo.address.isDefault">默认</view>
|
||||
<!-- <view class="tab-comm areaAddress_tab">家</view> -->
|
||||
<text>{{ assembleAddress(orderInfo.address).names }}</text>
|
||||
</view>
|
||||
<view class="header_detailedAddress_warp">
|
||||
<view style="width: 90%">{{ orderInfo.address.address }}</view>
|
||||
<up-image
|
||||
src="/static/common/right.png"
|
||||
width="20"
|
||||
height="20"
|
||||
bgColor="#f1f6ff00"
|
||||
></up-image>
|
||||
<up-image src="/static/common/right.png" width="20" height="20" bgColor="#f1f6ff00"></up-image>
|
||||
</view>
|
||||
<view class="header_name_warp">
|
||||
<text style="margin-right: 20rpx">{{ orderInfo.address.name }}</text>
|
||||
@@ -39,167 +24,92 @@
|
||||
<view class="no_address_title">
|
||||
<view>请填写地址</view>
|
||||
<view style="margin-top: 10rpx">
|
||||
<up-image
|
||||
src="/static/common/right.png"
|
||||
width="14"
|
||||
height="14"
|
||||
bgColor="#f1f6ff00"
|
||||
></up-image>
|
||||
<up-image src="/static/common/right.png" width="14" height="14" bgColor="#f1f6ff00"></up-image>
|
||||
</view>
|
||||
</view>
|
||||
<view class="no_address_msg">您还未添加收货地址,请完善地址!</view>
|
||||
</view>
|
||||
<!-- 店铺信息 -->
|
||||
<view
|
||||
class="order_store_warp order_product_warp"
|
||||
v-for="(item, index) in orderInfo.shops"
|
||||
:key="item.id"
|
||||
>
|
||||
<view class="order_store_warp order_product_warp" v-for="(item, index) in orderInfo.shops" :key="item.id">
|
||||
<!-- 头部 -->
|
||||
<view class="order_product_header">
|
||||
<up-image
|
||||
:src="item.logo"
|
||||
width="22"
|
||||
height="22"
|
||||
bgColor="#f1f6ff00"
|
||||
shape="circle"
|
||||
></up-image>
|
||||
<up-image :src="item.logo" width="22" height="22" bgColor="#f1f6ff00" shape="circle"></up-image>
|
||||
<view class="order_product_title">{{ item.name }}</view>
|
||||
</view>
|
||||
<view v-for="(addItem, addIndex) in item.addrTimes" :key="addIndex">
|
||||
<!-- 单个地址 -->
|
||||
<view
|
||||
v-if="addItem.address"
|
||||
class="shops_address_warp"
|
||||
@click="checkAddressShow(true, 'addrTimes', addIndex, index)"
|
||||
>
|
||||
<view v-if="addItem.address" class="shops_address_warp"
|
||||
@click="checkAddressShow(true, 'addrTimes', addIndex, index)">
|
||||
<view class="shops_address_warp_title">
|
||||
<text style="margin-right: 20rpx">{{ addItem.address.name }}</text>
|
||||
<text>{{ addItem.address.address }}</text>
|
||||
</view>
|
||||
<view>
|
||||
<up-image
|
||||
src="/static/common/right.png"
|
||||
width="16"
|
||||
height="16"
|
||||
bgColor="#f1f6ff00"
|
||||
></up-image>
|
||||
<up-image src="/static/common/right.png" width="16" height="16" bgColor="#f1f6ff00"></up-image>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 产品详情 -->
|
||||
<view
|
||||
v-if="ids"
|
||||
class="order_item_content"
|
||||
v-for="(pItem, pIndex) in addItem.goods"
|
||||
:key="pItem.id"
|
||||
>
|
||||
<up-image
|
||||
:src="pItem.img"
|
||||
width="80"
|
||||
height="80"
|
||||
bgColor="#f1f6ff00"
|
||||
@click="jumpProductInfo(pItem)"
|
||||
></up-image>
|
||||
<view v-if="ids" class="order_item_content" v-for="(pItem, pIndex) in addItem.goods" :key="pItem.id">
|
||||
<up-image :src="pItem.img" width="80" height="80" bgColor="#f1f6ff00"
|
||||
@click="jumpProductInfo(pItem)"></up-image>
|
||||
<view class="content_info_right">
|
||||
<view
|
||||
class="content_info_left_total"
|
||||
@click="jumpProductInfo(pItem)"
|
||||
>
|
||||
<view class="content_info_left_total" @click="jumpProductInfo(pItem)">
|
||||
<view class="content_info_title">{{ pItem.title }}</view>
|
||||
<view class="content_info_tag">{{ pItem.specs }}</view>
|
||||
</view>
|
||||
<view class="content_info_right_total">
|
||||
<view class="content_right_total">
|
||||
<view
|
||||
>¥<text style="font-size: 36rpx">{{
|
||||
pItem.totalPrice
|
||||
}}</text></view
|
||||
>
|
||||
<view>¥<text style="font-size: 36rpx">{{
|
||||
pItem.totalPrice
|
||||
}}</text></view>
|
||||
<view>每件到手价¥{{ pItem.unitPrice }}</view>
|
||||
</view>
|
||||
<view class="shopping_info_quantity">
|
||||
<view
|
||||
class="quantity_but"
|
||||
@click="quantityFun('minus', index, addIndex, pIndex)"
|
||||
>-</view
|
||||
>
|
||||
<view class="quantity_but" @click="quantityFun('minus', index, addIndex, pIndex)">-</view>
|
||||
<view class="quantity_value">{{ pItem.num }}</view>
|
||||
<view
|
||||
class="quantity_but"
|
||||
@click="quantityFun('add', index, addIndex, pIndex)"
|
||||
>+</view
|
||||
>
|
||||
<view class="quantity_but" @click="quantityFun('add', index, addIndex, pIndex)">+</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view
|
||||
v-else
|
||||
class="order_item_content"
|
||||
v-for="(pItem, pIndex) in addItem.goods"
|
||||
:key="pItem.id"
|
||||
>
|
||||
<up-image
|
||||
:src="pItem.img"
|
||||
width="80"
|
||||
height="80"
|
||||
bgColor="#f1f6ff00"
|
||||
@click="jumpProductInfo(pItem)"
|
||||
></up-image>
|
||||
|
||||
<view v-else class="order_item_content" v-for="(pItem, pIndex) in addItem.goods" :key="'else-' + pItem.id">
|
||||
<up-image :src="pItem.img" width="80" height="80" bgColor="#f1f6ff00"
|
||||
@click="jumpProductInfo(pItem)"></up-image>
|
||||
<view class="content_info_right">
|
||||
<view
|
||||
class="content_info_left_total"
|
||||
@click="jumpProductInfo(pItem)"
|
||||
>
|
||||
<view class="content_info_left_total" @click="jumpProductInfo(pItem)">
|
||||
<view class="content_info_title">{{ pItem.title }}</view>
|
||||
<view class="content_info_tag">{{ pItem.specs }}</view>
|
||||
</view>
|
||||
<view class="content_info_right_total">
|
||||
<view class="content_right_total">
|
||||
<view
|
||||
>¥<text style="font-size: 36rpx">{{
|
||||
pItem.totalPrice
|
||||
}}</text></view
|
||||
>
|
||||
<view>¥<text style="font-size: 36rpx">{{
|
||||
pItem.totalPrice
|
||||
}}</text></view>
|
||||
<view>每件到手价¥{{ pItem.unitPrice }}</view>
|
||||
</view>
|
||||
<view class="shopping_info_quantity">
|
||||
<view
|
||||
class="quantity_but"
|
||||
@click="quantityFun('minus', index, addIndex, pIndex)"
|
||||
>-</view
|
||||
>
|
||||
<view class="quantity_but" @click="quantityFun('minus', index, addIndex, pIndex)">-</view>
|
||||
<view class="quantity_value">{{ pItem.num }}</view>
|
||||
<view
|
||||
class="quantity_but"
|
||||
@click="quantityFun('add', index, addIndex, pIndex)"
|
||||
>+</view
|
||||
>
|
||||
<view class="quantity_but" @click="quantityFun('add', index, addIndex, pIndex)">+</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="content_info_right_remark">
|
||||
<view class="title">留言</view>
|
||||
<up-input
|
||||
placeholder="建议留言前先与商家沟通确认"
|
||||
border="surround"
|
||||
v-model="addItem.remark"
|
||||
:customStyle="{
|
||||
'text-align': 'right !important',
|
||||
border: '0rpx',
|
||||
}"
|
||||
style="text-align: right"
|
||||
></up-input>
|
||||
<up-input placeholder="建议留言前先与商家沟通确认" border="surround" v-model="addItem.remark" :customStyle="{
|
||||
'text-align': 'right !important',
|
||||
border: '0rpx',
|
||||
}" style="text-align: right"></up-input>
|
||||
</view>
|
||||
<!-- 运费 -->
|
||||
<view class="order_freight_warp" v-if="orderInfo">
|
||||
<view class="order_freight_item">
|
||||
<view
|
||||
>运费<text style="color: #c0c3c6; margin-left: 20rpx">{{
|
||||
getValue(PRODUCT_DELIVERY_TIME, addItem.deliveryTime)
|
||||
}}</text></view
|
||||
>
|
||||
<view>运费<text style="color: #c0c3c6; margin-left: 20rpx">{{
|
||||
getValue(PRODUCT_DELIVERY_TIME, addItem.deliveryTime)
|
||||
}}</text></view>
|
||||
<view class="value_">
|
||||
{{ orderInfo.postage ? "¥" + orderInfo.postage : "包邮" }}
|
||||
</view>
|
||||
@@ -220,42 +130,33 @@
|
||||
<up-image src="/static/common/right.png" width="20" height="20" bgColor="#f1f6ff00"></up-image>
|
||||
</view>
|
||||
</view> -->
|
||||
<!-- 优惠券信息 -->
|
||||
<view class="order_way_warp_two" v-if="isCoupon">
|
||||
<view class="price-view">
|
||||
<text class="text-32 text-zu">抵扣券余额</text>
|
||||
<text class="text-32 text-zu text-bold">{{ couponData.balance || 0 }}</text>
|
||||
</view>
|
||||
|
||||
<view class="price-view">
|
||||
<text class="text-32 text-zu">实付抵扣券 </text>
|
||||
<text class="text-32 text-zu text-bold">{{ buyCouponvalue }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="order_way_warp_two">
|
||||
<text class="text-32 text-zu">支付方式</text>
|
||||
<up-radio-group v-model="orderInfo.paymentMethod" placement="column">
|
||||
<view
|
||||
v-for="(item, index) in wayOption"
|
||||
:key="item.id"
|
||||
class="way-option"
|
||||
:style="{
|
||||
borderWidth: wayOption.length - 1 == index ? '0rpx' : '2rpx',
|
||||
}"
|
||||
>
|
||||
<view v-for="(item, index) in wayOption" :key="item.id" class="way-option" :style="{
|
||||
borderWidth: wayOption.length - 1 == index ? '0rpx' : '2rpx',
|
||||
}">
|
||||
<view class="way-option-item">
|
||||
<image
|
||||
v-if="item.type == 'wechat'"
|
||||
src="https://static.tbmall.xin/static/new/wx.png"
|
||||
></image>
|
||||
<image
|
||||
v-if="item.type == 'alipay'"
|
||||
src="https://static.tbmall.xin/static/new/zfb.png"
|
||||
></image>
|
||||
<image
|
||||
v-if="item.type == 'balance'"
|
||||
src="https://static.tbmall.xin/static/new/bank.png"
|
||||
></image>
|
||||
<image
|
||||
v-if="item.type == 'redpacket'"
|
||||
src="https://static.tbmall.xin/static/new/jf.png"
|
||||
></image>
|
||||
<text
|
||||
v-if="item.type == 'wechat' || item.type == 'alipay'"
|
||||
class="text-32 text-zu"
|
||||
style="margin-left: 20rpx"
|
||||
>{{ item.name }}</text
|
||||
>
|
||||
<text v-else style="margin-left: 20rpx" class="text-32 text-zu"
|
||||
>{{ item.name }}
|
||||
<image v-if="item.type == 'wechat'" src="https://static.tbmall.xin/static/new/wx.png"></image>
|
||||
<image v-if="item.type == 'alipay'" src="https://static.tbmall.xin/static/new/zfb.png"></image>
|
||||
<image v-if="item.type == 'balance'" src="https://static.tbmall.xin/static/new/bank.png"></image>
|
||||
<image v-if="item.type == 'redpacket'" src="https://static.tbmall.xin/static/new/jf.png"></image>
|
||||
<text v-if="item.type == 'wechat' || item.type == 'alipay'" class="text-32 text-zu"
|
||||
style="margin-left: 20rpx">{{ item.name }}</text>
|
||||
<text v-else style="margin-left: 20rpx" class="text-32 text-zu">{{ item.name }}
|
||||
<text style="color: #999; margin: 0 10rpx">可用:</text>
|
||||
{{ item.balance }}
|
||||
</text>
|
||||
@@ -267,15 +168,25 @@
|
||||
<view class="order_way_warp_two">
|
||||
<view class="price-view">
|
||||
<text class="text-32 text-zu">商品总价</text>
|
||||
<text class="text-32 text-zu text-bold"
|
||||
>¥{{ orderInfo.amount - orderInfo.postage + (orderInfo.enterpriseAmount || 0) }}</text
|
||||
>
|
||||
<text class="text-32 text-zu text-bold" v-if="isCoupon">
|
||||
{{ `${buyCouponvalue}抵扣券+${orderInfo.amount - (orderInfo.postage || 0) +
|
||||
(orderInfo.enterpriseAmount
|
||||
|| 0)}元` }}
|
||||
</text>
|
||||
<text class="text-32 text-zu text-bold" v-else>¥{{ orderInfo.amount - orderInfo.postage +
|
||||
(orderInfo.enterpriseAmount
|
||||
|| 0) }}</text>
|
||||
</view>
|
||||
<view class="price-view">
|
||||
<text class="text-32 text-zu">运费</text>
|
||||
<text class="text-32 text-zu text-bold">¥{{ orderInfo.postage }}</text>
|
||||
</view>
|
||||
<view class="price-view" v-if="user.isEnterpriseUser">
|
||||
|
||||
<view class="price-view" v-if="isCoupon">
|
||||
<text class="text-32 text-zu">抵扣券</text>
|
||||
<text class="text-32 text-zu text-bold">{{ buyCouponvalue }}抵扣券</text>
|
||||
</view>
|
||||
<view class="price-view" v-if="user?.isEnterpriseUser">
|
||||
<text class="text-32 text-zu">企业用户优惠</text>
|
||||
<text class="text-32 text-zu text-bold">¥{{ orderInfo.enterpriseAmount }}</text>
|
||||
</view>
|
||||
@@ -288,55 +199,34 @@
|
||||
<!-- 去支付的固定按钮 -->
|
||||
<view class="order_pay_but">
|
||||
<view class="price_">
|
||||
<text class="text-32" style="color: #999; font-weight: 400"
|
||||
>共
|
||||
<text class="text-32" style="color: #999; font-weight: 400">共
|
||||
<text>{{ totleNum }}</text>
|
||||
件
|
||||
</text>
|
||||
¥<text style="font-size: 60rpx">{{ orderInfo.amount }}</text></view
|
||||
>
|
||||
¥<text style="font-size: 60rpx">{{ orderInfo.amount }}</text>
|
||||
</view>
|
||||
<view class="_but" @click="goPay">支付</view>
|
||||
</view>
|
||||
|
||||
<!-- 选择支付方式 -->
|
||||
<up-popup
|
||||
v-model:show="wayShow"
|
||||
:round="10"
|
||||
:closeOnClickOverlay="false"
|
||||
:closeable="true"
|
||||
:safeAreaInsetBottom="false"
|
||||
>
|
||||
<up-popup v-model:show="wayShow" :round="10" :closeOnClickOverlay="false" :closeable="true"
|
||||
:safeAreaInsetBottom="false">
|
||||
<view class="way_popup_warp">
|
||||
<view class="way_popup_title">支付方式</view>
|
||||
<up-radio-group v-model="orderInfo.paymentMethod" placement="column">
|
||||
<view
|
||||
v-for="item in wayOption"
|
||||
:key="item.id"
|
||||
style="margin-bottom: 10rpx"
|
||||
>
|
||||
<view v-for="item in wayOption" :key="item.id" style="margin-bottom: 10rpx">
|
||||
<view class="way_item">
|
||||
<view class="way_item_">
|
||||
<view class="way_item_val"
|
||||
>{{ item.name
|
||||
}}<text v-if="item.balance"
|
||||
> ({{ item.balance }})</text
|
||||
>
|
||||
<view class="way_item_val">{{ item.name
|
||||
}}<text v-if="item.balance"> ({{ item.balance }})</text>
|
||||
</view>
|
||||
</view>
|
||||
<view
|
||||
v-if="item.type === 'balance' && isShowBalance"
|
||||
class="go_balance_comm_warp"
|
||||
@click="goRechargeFun(item)"
|
||||
>去充值</view
|
||||
>
|
||||
<view v-if="item.type === 'balance' && isShowBalance" class="go_balance_comm_warp"
|
||||
@click="goRechargeFun(item)">去充值</view>
|
||||
<up-radio v-else :name="item.type" activeColor="#03AD27">
|
||||
</up-radio>
|
||||
</view>
|
||||
<view
|
||||
class="balance_comm_msg"
|
||||
v-if="item.type === 'balance' && isShowBalance"
|
||||
>当前现金余额不足,如需支付请前往充值</view
|
||||
>
|
||||
<view class="balance_comm_msg" v-if="item.type === 'balance' && isShowBalance">当前现金余额不足,如需支付请前往充值</view>
|
||||
</view>
|
||||
</up-radio-group>
|
||||
<view class="popup_but" @click="wayShow = false"> 确认 </view>
|
||||
@@ -344,68 +234,38 @@
|
||||
</up-popup>
|
||||
|
||||
<!-- 选择地址 -->
|
||||
<up-popup
|
||||
v-model:show="addressShow"
|
||||
:round="10"
|
||||
:closeOnClickOverlay="false"
|
||||
:closeable="true"
|
||||
:safeAreaInsetBottom="false"
|
||||
@close="checkAddressShow(false, null, 0, 0)"
|
||||
>
|
||||
<up-popup v-model:show="addressShow" :round="10" :closeOnClickOverlay="false" :closeable="true"
|
||||
:safeAreaInsetBottom="false" @close="checkAddressShow(false, null, 0, 0)">
|
||||
<view class="address_popup_warp">
|
||||
<view class="address_popup_title">收件地址</view>
|
||||
<view class="address_popup_content">
|
||||
<view class="address_popup_content_add" @click="addAdress">
|
||||
+ 新增地址</view
|
||||
>
|
||||
+ 新增地址</view>
|
||||
<Address @valueFunc="getAddressValueFunc" />
|
||||
</view>
|
||||
<view class="popup_but" @click="addressOk"> 确认 </view>
|
||||
</view>
|
||||
</up-popup>
|
||||
<u-modal
|
||||
:show="tipsShow"
|
||||
title="提示"
|
||||
showCancelButton
|
||||
@cancel="onCancel"
|
||||
@confirm="onConfirm"
|
||||
:cancelText="type == 1 ? '取消' : '忘记密码'"
|
||||
:confirmText="type == 1 ? '去设置' : '重试'"
|
||||
confirmColor="#7934F6"
|
||||
:content="content"
|
||||
></u-modal>
|
||||
<u-modal :show="tipsShow" title="提示" showCancelButton @cancel="onCancel" @confirm="onConfirm"
|
||||
:cancelText="type == 1 ? '取消' : '忘记密码'" :confirmText="type == 1 ? '去设置' : '重试'" confirmColor="#7934F6"
|
||||
:content="content"></u-modal>
|
||||
|
||||
<u-keyboard
|
||||
ref="uKeyboard"
|
||||
mode="number"
|
||||
:show="show"
|
||||
@change="onChange"
|
||||
@backspace="onBackspace"
|
||||
:dotDisabled="true"
|
||||
:tooltip="false"
|
||||
>
|
||||
<u-keyboard ref="uKeyboard" mode="number" :show="show" @change="onChange" @backspace="onBackspace"
|
||||
:dotDisabled="true" :tooltip="false">
|
||||
<view style="background-color: #fff">
|
||||
<view class="money">
|
||||
<text style="color: #000; position: relative; top: 40rpx">
|
||||
<text style="font-size: 48rpx">¥</text>{{ orderInfo.amount }}</text
|
||||
>
|
||||
<text style="font-size: 48rpx">¥</text>{{ orderInfo.amount }}</text>
|
||||
<text class="text-40" style="margin-left: 20rpx"></text>
|
||||
<view class="text-28 close" data-flag="false" @tap="showPop(false)">
|
||||
<u-icon name="close" color="#333333" size="20"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
<view class="mid-tips">
|
||||
<u-code-input
|
||||
v-model="password"
|
||||
:dot="true"
|
||||
borderColor="#EAEAEA"
|
||||
:maxlength="6"
|
||||
@finish="finish"
|
||||
></u-code-input>
|
||||
<u-code-input v-model="password" :dot="true" borderColor="#EAEAEA" :maxlength="6"
|
||||
@finish="finish"></u-code-input>
|
||||
</view>
|
||||
<view class="tips text-28" style="color: #999; display: inline-block"
|
||||
>请输入支付密码</view
|
||||
>
|
||||
<view class="tips text-28" style="color: #999; display: inline-block">请输入支付密码</view>
|
||||
</view>
|
||||
</u-keyboard>
|
||||
|
||||
@@ -465,7 +325,9 @@ export default {
|
||||
}
|
||||
return num;
|
||||
},
|
||||
|
||||
},
|
||||
|
||||
components: {
|
||||
Address,
|
||||
Header,
|
||||
@@ -493,7 +355,7 @@ export default {
|
||||
selectAddress: {}, // 收件地址选择
|
||||
wayOption: [],
|
||||
isShowBalance: false,
|
||||
ji: 0,
|
||||
isPoints: 0, // 是否积分积分支付
|
||||
sed: null,
|
||||
curPay: null,
|
||||
user: null,
|
||||
@@ -501,32 +363,40 @@ export default {
|
||||
content: "您未设置支付密码,请先去设置支付密码",
|
||||
type: "1",
|
||||
defaultAddress: "",
|
||||
isCoupon: false, // 是否优惠卷
|
||||
couponData: {}, // 优惠卷数据
|
||||
allOrderInfo: {}, // 所有订单信息
|
||||
buyCouponvalue: 0, // 实付抵扣券积分
|
||||
buyCouponAmount: 0, // 实付抵扣券对应的钱
|
||||
};
|
||||
},
|
||||
async onLoad(option) {
|
||||
// const ids = option.ids;
|
||||
await this.addressList();
|
||||
if (option.address) {
|
||||
this.defaultAddress = option.address;
|
||||
}
|
||||
await this.addressList();
|
||||
if (option.address) {
|
||||
this.defaultAddress = option.address;
|
||||
}
|
||||
console.log('-------', option.isCoupon)
|
||||
if (option.isCoupon) {
|
||||
this.isCoupon = option.isCoupon;
|
||||
}
|
||||
if (option.sed) {
|
||||
this.ji = 1;
|
||||
this.isPoints = 1;
|
||||
this.sed = JSON.parse(option.sed);
|
||||
await this.addressList();
|
||||
// console.log('addressListOne',this.addressListOne)
|
||||
// if(this.addressListOne && this.addressListOne.length){
|
||||
// this.addressShow = true;
|
||||
// }
|
||||
await this.addressList();
|
||||
// console.log('addressListOne',this.addressListOne)
|
||||
// if(this.addressListOne && this.addressListOne.length){
|
||||
// this.addressShow = true;
|
||||
// }
|
||||
this.getOrderTwo();
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (option.ids) {
|
||||
this.ids = option.ids;
|
||||
this.getOrder();
|
||||
}
|
||||
|
||||
console.log("参数---", option,this.defaultAddress);
|
||||
|
||||
console.log("参数---", option, this.defaultAddress);
|
||||
|
||||
const addressShowPop = option.addressShow;
|
||||
if (addressShowPop && addressShowPop !== "null") {
|
||||
@@ -541,10 +411,19 @@ export default {
|
||||
this.getWayOption();
|
||||
this.getUserInfo();
|
||||
},
|
||||
mounted() {},
|
||||
mounted() { },
|
||||
methods: {
|
||||
getValue,
|
||||
assembleAddress,
|
||||
// 实付抵扣券
|
||||
onBuyCouponvalue(currentQuantity) {
|
||||
this.buyCouponvalue = Number((this.allOrderInfo.buyDeductionValue * (currentQuantity || 1)).toFixed(2)) || 0;
|
||||
|
||||
},
|
||||
// 实付抵扣券对应的钱
|
||||
onBuyCouponAmount() {
|
||||
this.buyCouponAmount = Number((this.sed.goodsNum * this.allOrderInfo.buyDeduction).toFixed(2)) || 0;
|
||||
},
|
||||
async addressList() {
|
||||
const res = await getAddress();
|
||||
if (res && res.bizcode === 100) {
|
||||
@@ -618,18 +497,24 @@ export default {
|
||||
},
|
||||
async getWayOption() {
|
||||
let parmas = {};
|
||||
if (this.ji) {
|
||||
if (this.isPoints) {
|
||||
parmas["types"] = "4";
|
||||
} else {
|
||||
parmas["types"] = "1,2,3";
|
||||
}
|
||||
console.log('parmas-----', this.isCoupon)
|
||||
|
||||
if (this.isCoupon) {
|
||||
parmas["types"] = "1,2,3";
|
||||
parmas.isDeduction = true;
|
||||
}
|
||||
const result = await getSupportPay(parmas);
|
||||
if (result && result.bizcode === 100) {
|
||||
const data = result.data || [];
|
||||
const amount = this.orderInfo.amount;
|
||||
let flag = data.some((item) =>
|
||||
["wechat", "alipay"].includes(item.type)
|
||||
);
|
||||
// const amount = this.orderInfo.amount;
|
||||
// let flag = data.some((item) =>
|
||||
// ["wechat", "alipay"].includes(item.type)
|
||||
// );
|
||||
// 没有支付宝和微信支付
|
||||
// if (flag) {
|
||||
// this.isShowBalance = false;
|
||||
@@ -637,8 +522,9 @@ export default {
|
||||
// const balanceFlag = data.some(item => item.type === "balance" && item.balance < amount);
|
||||
// this.isShowBalance = balanceFlag;
|
||||
// }
|
||||
this.wayOption = data;
|
||||
console.log("getWayOption", this.wayOption);
|
||||
this.wayOption = data.filter(item => item.type !== "vcoin");
|
||||
this.couponData = data.filter(item => item.type === "vcoin")[0] || {};
|
||||
console.log("getWayOption", this.wayOption, this.couponData);
|
||||
}
|
||||
},
|
||||
async getOrder() {
|
||||
@@ -697,14 +583,17 @@ export default {
|
||||
const params = {
|
||||
id: this.sed.id,
|
||||
};
|
||||
if(this.isCoupon){
|
||||
params.type = -1;
|
||||
}
|
||||
const resp = await getGoodsDetail(params);
|
||||
if (resp && resp.bizcode === 100) {
|
||||
const data = resp.data;
|
||||
this.ji = data.type == 3 ? 1 : 0;
|
||||
this.isPoints = data.type == 3 ? 1 : 0;
|
||||
this.orderInfo = {
|
||||
address: null,
|
||||
amount: this.sed.goodsNum * this.sed.specsId.price,
|
||||
postage:0,
|
||||
amount: this.sed.goodsNum * this.sed.specsId.price,
|
||||
postage: 0,
|
||||
shops: [
|
||||
{
|
||||
addrTimes: [
|
||||
@@ -742,20 +631,23 @@ export default {
|
||||
},
|
||||
],
|
||||
};
|
||||
console.log('this.defaultAddress',this.defaultAddress,this.addressListOne)
|
||||
if(this.defaultAddress && this.addressListOne && this.addressListOne.length){
|
||||
let arr = this.addressListOne.filter(i=>i.id == this.defaultAddress);
|
||||
if(arr.length){
|
||||
this.orderInfo.address = arr[0];
|
||||
}
|
||||
}
|
||||
if(!this.orderInfo.address && this.addressListOne && this.addressListOne.length){
|
||||
this.orderInfo.address = this.addressListOne[0];
|
||||
}
|
||||
console.log('this.defaultAddress', this.defaultAddress, this.addressListOne)
|
||||
if (this.defaultAddress && this.addressListOne && this.addressListOne.length) {
|
||||
let arr = this.addressListOne.filter(i => i.id == this.defaultAddress);
|
||||
if (arr.length) {
|
||||
this.orderInfo.address = arr[0];
|
||||
}
|
||||
}
|
||||
if (!this.orderInfo.address && this.addressListOne && this.addressListOne.length) {
|
||||
this.orderInfo.address = this.addressListOne[0];
|
||||
}
|
||||
this.allOrderInfo = data;
|
||||
this.orderInfo.paymentMethod = null;
|
||||
// if(this.addressListOne && this.addressListOne.length){
|
||||
// this.orderInfo.address = this.addressListOne[0];
|
||||
// }
|
||||
this.onBuyCouponvalue(this.sed.goodsNum || 1);
|
||||
this.onBuyCouponAmount();
|
||||
// if(this.addressListOne && this.addressListOne.length){
|
||||
// this.orderInfo.address = this.addressListOne[0];
|
||||
// }
|
||||
}
|
||||
// const params = {
|
||||
// cartIds: ids,
|
||||
@@ -827,24 +719,29 @@ export default {
|
||||
pIndex
|
||||
].totalPrice = currentTotalPrice.toFixed(2);
|
||||
this.orderInfo.amount = currentAmount.toFixed(2);
|
||||
|
||||
|
||||
const resp = await getSettleList({cartIds: this.ids});
|
||||
if (resp && resp.bizcode === 100) {
|
||||
const data = resp.data;
|
||||
const shops = data.shops;
|
||||
if (shops && shops.length !== 0) {
|
||||
shops.map((item) => {
|
||||
item.addrTimes.map((addItem) => {
|
||||
addItem.remark = null;
|
||||
if (this.isCoupon || this.sed) {
|
||||
this.onBuyCouponvalue(currentQuantity);
|
||||
this.onBuyCouponAmount();
|
||||
return;
|
||||
}
|
||||
|
||||
const resp = await getSettleList({ cartIds: this.ids });
|
||||
if (resp && resp.bizcode === 100) {
|
||||
const data = resp.data;
|
||||
const shops = data.shops;
|
||||
if (shops && shops.length !== 0) {
|
||||
shops.map((item) => {
|
||||
item.addrTimes.map((addItem) => {
|
||||
addItem.remark = null;
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
data.shops = shops;
|
||||
data.paymentMethod = null; // 支付方式
|
||||
this.orderInfo = data;
|
||||
}
|
||||
data.shops = shops;
|
||||
data.paymentMethod = null; // 支付方式
|
||||
this.orderInfo = data;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// 获取备注
|
||||
@@ -915,8 +812,18 @@ export default {
|
||||
return (this.tipsShow = true);
|
||||
}
|
||||
|
||||
console.log("orderInfo----", arr);
|
||||
if (arr.length) {
|
||||
if (arr[0].type == "balance" || arr[0].type == "redpacket") {
|
||||
if (this.isCoupon) {
|
||||
if (this.buyCouponvalue > this.couponData.balance) {
|
||||
this.$refs.uToastRef.show({
|
||||
type: "error",
|
||||
message: "您当前优惠券金额不足",
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.show = true;
|
||||
} else if (arr[0].type == "balance" || arr[0].type == "redpacket") {
|
||||
this.show = true;
|
||||
} else {
|
||||
this.passPay();
|
||||
@@ -933,16 +840,20 @@ export default {
|
||||
remark: JSON.stringify(this.getRemark()), //备注信息'[{"sid":"店铺ID","rmk":"备注内容"},{"sid":"店铺ID","rmk":"备注内容"}]'
|
||||
};
|
||||
let resp = null;
|
||||
console.log("orderInfo----", this.sed);
|
||||
if (this.sed) {
|
||||
if (
|
||||
this.orderInfo.paymentMethod == "balance" ||
|
||||
this.orderInfo.paymentMethod == "redpacket"
|
||||
this.orderInfo.paymentMethod == "redpacket" ||
|
||||
this.isCoupon
|
||||
) {
|
||||
params["password"] = CryptoJS.MD5(this.payPwd).toString();
|
||||
}
|
||||
params["goodsId"] = this.sed.id;
|
||||
params["specsId"] = this.sed.specsId.id;
|
||||
params["goodsNum"] = this.orderInfo.shops[0].addrTimes[0].goods[0].num;
|
||||
if (this.isCoupon) params.payway2 = 'vcoin';
|
||||
|
||||
resp = await settlementOrder(params);
|
||||
} else {
|
||||
params["cartIds"] = this.ids;
|
||||
@@ -1086,6 +997,7 @@ export default {
|
||||
background-color: #fff;
|
||||
border-radius: 16rpx;
|
||||
margin-top: 24rpx;
|
||||
|
||||
.price-view-two {
|
||||
width: 100%;
|
||||
height: 108rpx;
|
||||
@@ -1094,11 +1006,13 @@ export default {
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.price-line {
|
||||
width: 100%;
|
||||
min-height: 1rpx;
|
||||
background-color: #ececec;
|
||||
}
|
||||
|
||||
.price-view {
|
||||
width: 100%;
|
||||
height: 72rpx;
|
||||
@@ -1106,6 +1020,7 @@ export default {
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.way-option {
|
||||
height: 112rpx;
|
||||
width: 100%;
|
||||
@@ -1114,11 +1029,13 @@ export default {
|
||||
align-items: center;
|
||||
border-bottom: 1rpx solid #ececec;
|
||||
justify-content: space-between;
|
||||
|
||||
.way-option-item {
|
||||
height: 112rpx;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
|
||||
image {
|
||||
width: 48rpx;
|
||||
height: 48rpx;
|
||||
@@ -1126,6 +1043,7 @@ export default {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.money {
|
||||
text-align: center;
|
||||
font-size: 68rpx;
|
||||
@@ -1133,6 +1051,7 @@ export default {
|
||||
position: relative;
|
||||
background-color: #fff;
|
||||
height: 180rpx;
|
||||
|
||||
.close {
|
||||
position: absolute;
|
||||
top: 20rpx;
|
||||
@@ -1141,12 +1060,14 @@ export default {
|
||||
font-size: 28rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.mid-tips {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.tips {
|
||||
color: $u-tips-color;
|
||||
margin: 20rpx 0;
|
||||
@@ -1154,6 +1075,7 @@ export default {
|
||||
background-color: #fff;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.order_submit_warp {
|
||||
background-color: $app-bj;
|
||||
height: calc(100vh - 200rpx);
|
||||
@@ -1276,8 +1198,7 @@ export default {
|
||||
width: calc(100% - 160rpx);
|
||||
}
|
||||
|
||||
.content_info_left_total {
|
||||
}
|
||||
.content_info_left_total {}
|
||||
|
||||
.content_info_title {
|
||||
width: 460rpx;
|
||||
|
||||
Reference in New Issue
Block a user