web-base-h5/pages/shareArea/orderShare.vue

497 lines
13 KiB
Vue
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!--
* @Descripttion:
* @version:
* @Author: kBank
* @Date: 2022-11-21 15:11:22
-->
<template>
<view class="content">
<view class="index_header">
</view>
<view class="context">
<u-form :model="form"
labelAlign="right"
labelWidth="75"
:rules="rules"
ref="uForm">
<view class="kuang">
<u-form-item :label="$t('MN_F_T_140')">
<view class="pickerHui">
<u-input v-model="form.deliveryName"
disabled
:placeholder="$t('w_0062')"
border="none"></u-input>
<u-icon name="arrow-down"></u-icon>
</view>
</u-form-item>
</view>
<view class="kuang">
<view class="disFlex tit_t">
<view></view>
<!-- <view class="lan" @click="addAdress">新增收货人地址</view> -->
</view>
<u-form-item :label="$t('MY_ORD_10')"
prop="recName">
<u-input v-model.trim="form.recName"
:placeholder="$t('w_0067')" />
</u-form-item>
<u-form-item :label="$t('w_0242')"
prop="recPhone">
<u-input v-model.trim="form.recPhone" maxlength="20"
type="number"
:placeholder="$t('w_0321')" />
</u-form-item>
<u-form-item :label="$t('w_0068')"
prop="diqu"
@click='getDiqu'>
<view class="picker">
<u-input v-model.trim="form.diqu"
:placeholder="$t('w_0322')"
border="none"></u-input>
<u-icon name="arrow-down"></u-icon>
</view>
</u-form-item>
<u-form-item :label="$t('S_C_27')"
prop="recAddress">
<u--textarea v-model.trim="form.recAddress"
maxlength="200"
:placeholder="$t('w_0070')"></u--textarea>
</u-form-item>
<u-form-item :label="$t('w_0071')">
<u-input disabled
v-model="form.postage" />
</u-form-item>
<u-form-item :label="$t('MY_WAL_22')">
<u--textarea v-model="form.remark"
:placeholder="$t('w_0072')"></u--textarea>
</u-form-item>
</view>
</u-form>
<view class="kuang">
<view class="kuang_t">
<view class="kuang_tl">
<view class="sTit">{{$t('w_0323')}}</view>
<img :src="allData.cover"
alt="">
<view class="sTit">{{$t('w_0078')}}</view>
<view class="cTit">{{ allData.waresName }}</view>
</view>
<view class="kuang_tr">
<view class="sTit">{{$t('ENU_N_B_T_3')}}</view>
<view v-for="item,index in allData.productParams"
:key="index">
<view v-for="ctem,cndex in item.waresItemsParamsList"
v-if="ctem.quantity>0"
:key="cndex"
class="cTit">
{{ item.productName }}{{ ctem.specsName }}*{{ ctem.quantity }}
</view>
</view>
</view>
</view>
<view class="kuang_t">
<view class="kuang_tl">
<view class="sTit">{{$t('w_0080')}}(¥)</view>
<view class="cTit">{{ allData.goodsPrice | numberToCurrency }}</view>
</view>
<view class="kuang_tr">
<view class="sTit">{{$t('w_0080')}}(PV)</view>
<view class="cTit">{{ allData.goodsAchive | numberToCurrency }}</view>
</view>
</view>
<view class="kuang_t">
<view class="kuang_tl">
<view class="sTit">{{$t('w_0081')}}</view>
<u-number-box :min="1"
v-model="goodsNum"
@change="valChange"></u-number-box>
</view>
<view></view>
</view>
</view>
<view class="kuang">
<view class="disFlex just">
<view>{{$t('w_0083')}}(¥)</view>
<view>{{ priceAmount | numberToCurrency}}</view>
</view>
<view class="disFlex just">
<view>{{$t('w_0080')}}{{$t('w_0340')}}(PV)</view>
<view>{{ achiveAmount | numberToCurrency}}</view>
</view>
<view class="disFlex just">
<view>{{$t('w_0071')}}</view>
<view>{{ form.postage | numberToCurrency}}</view>
</view>
</view>
<view class="kuang disFlex">
<u-checkbox-group v-model="checkboxValue1"
@change="checkboxChange">
<u-checkbox :name="1">
</u-checkbox>
</u-checkbox-group>
<view class="tit3">{{$t('w_0207')}}</view>
<view class="tit2"> {{$t('w_0208')}}</view>
</view>
</view>
<!-- 占空 -->
<view style="height:150rpx"></view>
<!-- 底部 -->
<view class="footer_f">
<view class="footer">
<view class="footer_l">
<view class="disFlex">
<view class="h1">{{$t('w_0325')}}</view>
<view class="r1">¥{{ totalMont | numberToCurrency}}</view>
</view>
<view class="disFlex">
<view class="h1">{{$t('ENU_TOTAL_V_1')}}</view>
<view class="l1">¥{{ achiveAmount | numberToCurrency}}</view>
</view>
</view>
<view class="footer_r">
<u-button type="success"
class="uBtn"
shape="circle"
:loading="isLoading"
:loadingText="$t('w_0313')"
@tap="goBuy"
color="linear-gradient(to right, #fb3024, #fb3024 )">{{$t('w_0163')}} </u-button>
</view>
</view>
</view>
<agreement ref="agreement"></agreement>
<v-address ref="address"
:defaultCode="defaultCode"
@addressData="addressData"></v-address>
</view>
</template>
<script>
import address from '@/components/address.vue'
import * as api from '@/config/goods'
import agreement from '@/components/agreement.vue'
export default {
components: {
'v-address': address,
agreement,
},
data() {
return {
specialArea: 7,
defaultCode: [],
form: {
deliveryName: this.$t('ENU_DELIVERY_1'),
deliveryWay: 1,
postage: 0,
transType: 1,
},
deliList: [],
diqu: '',
allData: [],
goodsNum: 1,
checkboxValue1: [],
priceAmount: 0, //商品总价
achiveAmount: 0, //总业绩
totalMont: 0,
orderItemsParams: [],
isLoading: false,
centerCodeId: '',
rules: {
recName: [
{
required: true,
message: this.$t('w_0067'),
trigger: ['change', 'blur'],
},
],
recPhone: [
{
required: true,
message: this.$t('w_0321'),
trigger: ['change', 'blur'],
},
],
diqu: [
{
required: true,
message: this.$t('w_0069'),
trigger: ['change', 'blur'],
},
],
recAddress: [
{
required: true,
message: this.$t('w_0070'),
trigger: ['change', 'blur'],
},
],
},
}
},
onLoad(options) {
let user = uni.getStorageSync('User')
this.centerCodeId = user.memberCode
this.allData = JSON.parse(options.allData)
this.getGenerate()
this.valChange({ value: 1 })
// 发货方式
// this.getDeliveryList()
},
onShow() {},
methods: {
addAdress() {
uni.navigateTo({
url: '/pages/address/index',
})
},
toAgree() {
// agreeMent
this.$refs.agreement.openDig()
},
getGenerate() {
api.generate().then((res) => {
uni.setStorageSync('mToken', res.msg)
})
},
goBuy() {
this.$refs.uForm.validate().then((res) => {
this.isLoading = true
api
.confirmFunShareOrder(
Object.assign({}, this.form, {
orderItemsParams: this.orderItemsParams,
specialArea: this.specialArea,
})
)
.then((res) => {
this.isLoading = false
if (res.code == 200) {
uni.navigateTo({
url:
'/pages/pay/index?paramsPost=' +
JSON.stringify(res.data) +
'&businessType=1',
})
}
})
})
},
setGoodlistType() {
let carList = {
quantity: this.goodsNum,
waresCode: this.allData.waresCode,
waresItemsParamList: [],
}
this.allData.productParams.forEach((item) => {
item.waresItemsParamsList.forEach((ctem) => {
if (ctem.quantity != 0) {
carList.waresItemsParamList.push({
pkWaresSpecsSku: ctem.pkSkuId,
quantity: ctem.quantity,
})
}
})
})
this.orderItemsParams = [carList]
},
checkboxChange() {},
valChange(e) {
this.goodsNum = e.value
this.priceAmount = this.allData.goodsPrice * this.goodsNum
this.achiveAmount = this.allData.goodsAchive * this.goodsNum
this.totalMont = this.priceAmount
this.setGoodlistType()
if (this.form.recProvince) {
this.queryAdressPostage()
}
},
getDiqu() {
this.$refs.address.setShow()
},
confirmPopup() {},
queryAdressPostage() {
api
.queryAdressPostage(
Object.assign({}, this.form, {
orderItemsParams: this.orderItemsParams,
})
)
.then((res) => {
this.form.postage = Number(res.data.postage).toFixed(2)
this.totalMont =
parseFloat(this.priceAmount) + parseFloat(res.data.postage)
this.totalMont = this.totalMont.toFixed(3)
})
},
addressData(diqu, obj) {
this.form.diqu = diqu
this.form.recProvince = obj.province
this.form.recCity = obj.city
this.form.recCounty = obj.county
this.$forceUpdate()
this.setGoodlistType()
this.queryAdressPostage()
},
},
}
</script>
<style lang="scss" scoped>
.content {
background: #f9f9f9;
}
.index_header {
background: #f9f9f9;;
height: 330rpx;
}
.context {
position: relative;
padding: 24rpx;
margin-top: -360rpx;
}
.disFlex {
display: flex;
align-items: center;
}
.just {
justify-content: space-between;
font-size: 12px;
font-family: PingFang SC-Medium, PingFang SC;
font-weight: 500;
color: #333333;
margin-bottom: 10rpx;
}
.kuang {
margin-top: 20rpx;
padding: 20rpx 40rpx;
background: #fff;
box-shadow: 0px 2px 10px 0px rgba(204, 204, 204, 0.5);
border-radius: 10px 10px 10px 10px;
.tit_t {
justify-content: space-between;
font-size: 14px;
font-family: PingFang SC-Semibold, PingFang SC;
font-weight: 600;
color: #333333;
}
.lan {
font-size: 10px;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #289fff;
}
}
.picker {
display: flex;
justify-content: space-between;
width: 100%;
border-width: 0.5px !important;
border-color: #dadbde !important;
border-style: solid;
border-radius: 4px;
padding: 6px 9px;
}
.pickerHui {
display: flex;
justify-content: space-between;
width: 100%;
border-width: 0.5px !important;
border-color: #dadbde !important;
border-style: solid;
border-radius: 4px;
padding: 6px 9px;
background: #f5f7fa;
}
.kuang_t {
display: flex;
.kuang_tl {
flex: 1;
img {
width: 40px;
height: 40px;
border-radius: 6px 6px 6px 6px;
}
}
.kuang_tr {
flex: 1;
}
}
.sTit {
font-size: 12px;
font-family: PingFang SC-Medium, PingFang SC;
font-weight: 500;
color: #999999;
margin: 14rpx 0;
}
.cTit {
font-size: 13px;
font-family: PingFang SC-Medium, PingFang SC;
font-weight: 500;
color: #333333;
margin-bottom: 14rpx;
}
.footer_f {
position: fixed;
bottom: 0;
width: 100%;
z-index: 10;
box-shadow: 0px -2px 20px 0px rgba(204, 204, 204, 0.5);
}
.footer {
display: flex;
justify-content: space-between;
padding: 20rpx 24rpx 40rpx 20rpx;
background: #fff;
.footer_l {
}
.footer_r {
// flex: 1;
display: flex;
align-items: center;
font-size: 20rpx;
font-weight: 500;
color: #333333;
}
}
.h1 {
font-size: 10px;
font-family: PingFang SC-Medium, PingFang SC;
font-weight: 500;
color: #333333;
margin-right: 20rpx;
}
.r1 {
font-size: 18px;
font-family: PingFang SC-Semibold, PingFang SC;
font-weight: 600;
color: #ed4623;
}
.l1 {
font-size: 16px;
font-family: PingFang SC-Semibold, PingFang SC;
font-weight: 600;
color: #384a8a;
}
.tit2 {
font-size: 26rpx;
font-family: Source Han Sans CN;
font-weight: bold;
color: #fb3024;
}
.tit3 {
font-size: 26rpx;
font-family: Source Han Sans CN;
font-weight: 400;
color: #333;
}
</style>