|
@@ -7,11 +7,8 @@
|
|
|
<!-- 运费 -->
|
|
|
<seller-freight ref="freight"
|
|
|
v-if="isRequest"
|
|
|
- :freightDatas="freightData"
|
|
|
- @handleChoiceaFreight="handleChoiceaFreightData"
|
|
|
- @showFreightAlert="handFreightAlertShow">
|
|
|
+ :freightDatas="freightData">
|
|
|
</seller-freight>
|
|
|
- <freight-alert v-if="isfreightTip" ref="csPhone"></freight-alert>
|
|
|
<!-- 底部 -->
|
|
|
<view class="footer" :style="{paddingBottom :isIphoneX ? '68rpx' : '0rpx'}">
|
|
|
<view class="footer-le">
|
|
@@ -29,7 +26,7 @@
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
-<script>
|
|
|
+<script>
|
|
|
import choiceAddress from '@/components/cm-module/creatOrder/address'
|
|
|
import goodsList from '@/components/cm-module/creatOrder/goodsList'
|
|
|
import sellerFreight from '@/components/cm-module/creatOrder/sellerFreight'
|
|
@@ -42,62 +39,55 @@
|
|
|
data() {
|
|
|
return {
|
|
|
isSubLoading:false,
|
|
|
- orderID:0,
|
|
|
- userId:'',
|
|
|
productIds:'', //获取上一级页面商品信息
|
|
|
productCount:'', //获取上一级页面商品数量
|
|
|
- classifyIDS:'', //获取上一级页面商品分类
|
|
|
- serviceProviderId:'', //协销ID
|
|
|
- submitState:'', //提交状态
|
|
|
allCount:1, //订单提交总数量
|
|
|
totalOriginalPrice:0, //订单总原价(划线部分)
|
|
|
- totalFullReduction:0, //满减金额
|
|
|
+ totalFullReduction:0, //满减金额
|
|
|
payAllPrice:0.00, //订单提交总金额
|
|
|
allPrice:0.00, //订单总金额
|
|
|
- addressId:'', //地址ID
|
|
|
townId:'', //区ID
|
|
|
isRequest:false, //是否加载完成渲染子组件
|
|
|
isFreight:false, //是否加载完成渲染子组件
|
|
|
isAddress:false, //是否加载完成地址
|
|
|
- isfreightTip:false, //控制邮费弹窗
|
|
|
ischecked:false, //是否勾选余额
|
|
|
- addressData:{
|
|
|
- address: "奥术大师大所打撒大是奥术大师大所打撒大是奥术大师大所打撒大是",
|
|
|
- addressID: 2913,
|
|
|
- city: "县",
|
|
|
- cityID: 2,
|
|
|
- defaultFlag: "1",
|
|
|
- mobile: "13316418828",
|
|
|
- phone: null,
|
|
|
- postalCode: null,
|
|
|
- province: "北京市",
|
|
|
- provinceID: 1,
|
|
|
- shouHuoRen: "郑大大",
|
|
|
- town: "东城区282",
|
|
|
- townID: 17,
|
|
|
- userID: 11063
|
|
|
- },//初始化地址信息
|
|
|
- goodsData:[
|
|
|
-
|
|
|
- ],//初始化商品信息
|
|
|
- invoiceData:{type:0}, //初始化发票信息
|
|
|
+ addressData:{},//初始化地址信息
|
|
|
+ goodsData:[],//初始化商品信息
|
|
|
freightData:{}, //邮费数据
|
|
|
- orderInfo:[], //提交的商品信息
|
|
|
- payInfo:{}, //订单信息
|
|
|
isIphoneX:this.$store.state.isIphoneX,
|
|
|
- clauseId:0,
|
|
|
productsList:[],
|
|
|
+ params:{
|
|
|
+ userId:0,
|
|
|
+ productIds:'',
|
|
|
+ productCount:0
|
|
|
+ },
|
|
|
+ subParams:{
|
|
|
+ userId:0,
|
|
|
+ orderInfo:[],//提交的商品信息
|
|
|
+ addressId:0,
|
|
|
+ cartType:0,
|
|
|
+ payInfo:{
|
|
|
+ orderShouldPayFee:0
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
onLoad(option){//商品数据
|
|
|
- this.getInitCrearOrder();
|
|
|
let data = JSON.parse(option.data);
|
|
|
- this.allPrice = data.data.allPrice;
|
|
|
this.allCount = data.data.allCount;
|
|
|
- this.payAllPrice = this.totalPrice;
|
|
|
- this.userId = data.data.userId
|
|
|
- this.productIds = data.data.productID
|
|
|
- console.log(this.allCount)
|
|
|
+ if(option.type =='prodcut'){
|
|
|
+ this.subParams.cartType = 2
|
|
|
+ this.params.productCount = data.data.productCount
|
|
|
+ this.params.productIds = data.data.productIds
|
|
|
+ }else{
|
|
|
+ this.subParams.cartType = 1
|
|
|
+ this.params.productCount = data.data.productCount
|
|
|
+ this.params.productIds = data.data.productIds
|
|
|
+ }
|
|
|
+ this.$api.getStorage().then((resolve) =>{
|
|
|
+ this.params.userId = this.subParams.userId = resolve.userId ? resolve.userId : 0
|
|
|
+ this.getInitCrearOrder(this.params);
|
|
|
+ })
|
|
|
},
|
|
|
filters:{
|
|
|
NumFormat(value) {//处理金额
|
|
@@ -105,107 +95,62 @@
|
|
|
},
|
|
|
},
|
|
|
methods: {
|
|
|
- getInitCrearOrder(option){//确认订单初始化信息
|
|
|
- let params ={
|
|
|
- userId:11104,
|
|
|
- count:1,
|
|
|
- productIds:1010,
|
|
|
- unionId:'ox_1SwWzHhZwQg1va3Sr-InZoccc'
|
|
|
- }
|
|
|
+ getInitCrearOrder(params){//确认订单初始化信息
|
|
|
this.OrderService.QueryOrderConfirm(params)
|
|
|
.then(response =>{
|
|
|
let data = response.data
|
|
|
let productIds = []
|
|
|
this.isRequest = true
|
|
|
this.goodsData = data.shopList
|
|
|
- this.totalFullReduction = data.totalFullReduction
|
|
|
- this.totalOriginalPrice = data.totalFullReduction + data.totalPrice
|
|
|
+ // this.totalFullReduction = data.totalFullReduction
|
|
|
+ // this.totalOriginalPrice = data.totalFullReduction + data.totalPrice
|
|
|
this.allPrice = this.payAllPrice = data.totalPrice
|
|
|
+ this.subParams.payInfo.orderShouldPayFee = this.payAllPrice.toFixed(2)
|
|
|
+ console.log('this.subParams.payInfo.orderShouldPayFee',this.subParams.payInfo.orderShouldPayFee)
|
|
|
})
|
|
|
.catch(error =>{
|
|
|
this.$util.msg(error.msg,2000)
|
|
|
})
|
|
|
},
|
|
|
getAddressData(){//获取地址信息
|
|
|
- this.UserService.QueryAddressList({pageNum:1,pageSize:1,userId:11104})
|
|
|
- .then(response =>{
|
|
|
- this.isAddress = true
|
|
|
- this.addressData = {}
|
|
|
- if(response.data.list != ''){
|
|
|
- this.addressId = response.data.list[0].addressId;
|
|
|
- this.townId = response.data.list[0].townId;
|
|
|
- this.addressData = response.data.list[0];
|
|
|
- }else{
|
|
|
- this.addressData = this.addressData;
|
|
|
- }
|
|
|
+ this.$api.getStorage().then((resolve) => {
|
|
|
+ this.UserService.QueryAddressList({pageNum:1,pageSize:1,userId:resolve.userId})
|
|
|
+ .then(response =>{
|
|
|
+ this.isAddress = true
|
|
|
+ this.addressData = {}
|
|
|
+ if(response.data.list != ''){
|
|
|
+ this.subParams.addressId = response.data.list[0].addressId;
|
|
|
+ this.townId = response.data.list[0].townId;
|
|
|
+ this.addressData = response.data.list[0];
|
|
|
+ }else{
|
|
|
+ this.addressData = this.addressData;
|
|
|
+ }
|
|
|
+ })
|
|
|
})
|
|
|
},
|
|
|
handChangeInputGoodsList(data){//对应供应商的留言信息
|
|
|
this.goodsData = data;
|
|
|
},
|
|
|
- handleChoiceaInvoiceData(data){//获取发票信息
|
|
|
- this.invoiceData = data
|
|
|
- },
|
|
|
- handleChoiceaFreightData(data){//获取运费信息
|
|
|
- if(data.freePostFlag == '1'){
|
|
|
- this.freightData = data
|
|
|
- this.payAllPrice = this.allPrice+parseInt(data.freight)
|
|
|
- this.attributePallPrice()
|
|
|
- }else{
|
|
|
- this.freightData = data
|
|
|
- this.payAllPrice = this.allPrice
|
|
|
- this.attributePallPrice()
|
|
|
- }
|
|
|
- },
|
|
|
- attributePallPrice(){//计算价格
|
|
|
- if(this.freightData.freePostFlag == 1 || this.freightData.freePostFlag == '1'){
|
|
|
- this.attributeHashfreight(this.freightData.freight)
|
|
|
- }else{
|
|
|
- this.attributeNofreight()
|
|
|
- }
|
|
|
- },
|
|
|
- attributeNofreight(){//计算没有邮费的支付价格
|
|
|
- this.payAllPrice = this.allPrice;
|
|
|
- },
|
|
|
- attributeHashfreight(freight){//计算需要邮费的支付价格
|
|
|
- this.payAllPrice = this.allPrice+parseInt(freight)//计算不包邮的价格 总价等于商品价格+邮费
|
|
|
- },
|
|
|
orderSubmitMit(){//提交订单
|
|
|
if(this.isSubLoading){ return; }
|
|
|
- if(this.addressId == ''){
|
|
|
+ if(this.subParams.addressId == ''){
|
|
|
this.$util.msg('请先添加收货地址~',2000)
|
|
|
return
|
|
|
}
|
|
|
// 处理商品信息及留言
|
|
|
- this.orderInfo = this.goodsData.map(el => {
|
|
|
+ this.subParams.orderInfo = this.goodsData.map(el => {
|
|
|
let productInfo = [];
|
|
|
el.productList.forEach(item => {
|
|
|
productInfo.push({
|
|
|
productId:item.productId,
|
|
|
- productNum:item.productCount,
|
|
|
- productType:item.productType ? Number(item.productType) : 0,
|
|
|
- presentNum:0,
|
|
|
+ productNum:item.productCount
|
|
|
})
|
|
|
})
|
|
|
return {shopId:el.shopId,note:el.note?el.note:'',productInfo:productInfo}
|
|
|
})
|
|
|
- //订单信息
|
|
|
- this.payInfo = {
|
|
|
- orderShouldPayFee:this.payAllPrice.toFixed(2),//提交的总价
|
|
|
- balancePayFlag:this.balanceDeductionFlag,//余额抵扣的状态
|
|
|
- freight:-1,//邮费
|
|
|
- freePostFlag:-1//运费形式
|
|
|
- }
|
|
|
- console.log(this.payInfo)
|
|
|
- let params = {
|
|
|
- clubUserId:this.userId,
|
|
|
- addressId:this.addressId, //地址ID
|
|
|
- orderInfo:this.orderInfo, //商品信息
|
|
|
- payInfo:this.payInfo, //订单信息
|
|
|
- orderInvoice:this.invoiceData //发票信息
|
|
|
- }
|
|
|
+ console.log(this.subParams)
|
|
|
this.isSubLoading = true;
|
|
|
- this.OrderService.CreatedOrderSubmit(params).then(response =>{
|
|
|
+ this.OrderService.CreatedOrderSubmit(this.subParams).then(response =>{
|
|
|
const data = response.data;
|
|
|
this.$util.msg('订单提交成功',2000,true,'success')
|
|
|
setTimeout(()=>{
|
|
@@ -218,21 +163,14 @@
|
|
|
this.$util.msg(error.msg,2000);
|
|
|
})
|
|
|
},
|
|
|
- handFreightAlertShow(){//显示邮费弹窗
|
|
|
- this.isfreightTip = true;
|
|
|
- },
|
|
|
- hideFreight(){//关闭邮费弹窗
|
|
|
- this.isfreightTip = false;
|
|
|
- },
|
|
|
},
|
|
|
onShow() {
|
|
|
- // this.addressId = ''
|
|
|
let pages = getCurrentPages();
|
|
|
let currPage = pages[pages.length-1];
|
|
|
if(currPage.data.select =='select'){
|
|
|
this.isAddress = true
|
|
|
let SelectData = uni.getStorageSync('selectAddress');
|
|
|
- this.addressId = SelectData.addressId;
|
|
|
+ this.subParams.addressId = SelectData.addressId;
|
|
|
this.addressData = SelectData
|
|
|
}else{
|
|
|
this.getAddressData()
|
|
@@ -377,7 +315,7 @@
|
|
|
float: right;
|
|
|
text-align: right;
|
|
|
color: $text-color;
|
|
|
- padding: 10rpx 20rpx 10rpx 0;
|
|
|
+ padding-right:20rpx;
|
|
|
box-sizing: border-box;
|
|
|
width: 370rpx;
|
|
|
.sum{
|