|
|
@@ -14,7 +14,7 @@
|
|
|
<view class="set_text">修改</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view class="add_name mar_t20">{{DefaultAddress.province}}{{DefaultAddress.city}}{{DefaultAddress.county}}{{DefaultAddress.address}}</view>
|
|
|
+ <view class="add_name mar_t20">{{DefaultAddress.address}}</view>
|
|
|
</block>
|
|
|
<block v-else>
|
|
|
<view class="add_address flex_c flex_ac flex_jc" @tap="chooseWXaddress">
|
|
|
@@ -27,14 +27,14 @@
|
|
|
|
|
|
<!-- 商品信息 -->
|
|
|
<view class="goods_info mar_t20">
|
|
|
- <view class="info_type">{{modularName}}</view>
|
|
|
- <view class="goods flex_r" v-for="(item,index) in goodsInfo" :key="index">
|
|
|
- <image class="goods_img" :src="item.goodsImgUrl" mode=""></image>
|
|
|
+ <view class="info_type">专区</view>
|
|
|
+ <view class="goods flex_r">
|
|
|
+ <image class="goods_img" :src="goodsInfo.goods.original_img" mode=""></image>
|
|
|
<view class="goods_con flex_c flex_jc flex_jb">
|
|
|
- <view class="goods_name">{{item.goodsName}}</view>
|
|
|
+ <view class="goods_name">{{goodsInfo.goods.goods_name}}</view>
|
|
|
<view class="flex_r flex_ac flex_jb">
|
|
|
- <view class="goods_msg">{{Data.goodsType == 5 ? item.goodsIntegral + '消费积分' : '¥' + item.goodsPrice}}</view>
|
|
|
- <view class="goods_num">x {{item.buyCount ? item.buyCount : 1}}</view>
|
|
|
+ <view class="goods_msg">{{Data.type == 2 ? goodsInfo.trade_num + '消费积分' + '¥' + goodsInfo.trade_price : '¥' + goodsInfo.cost_price}}</view>
|
|
|
+ <view class="goods_num">x {{Data.num}}</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
@@ -45,51 +45,51 @@
|
|
|
<view class="order mar_t20">
|
|
|
<view class="order_list flex_r flex_ac flex_jb">
|
|
|
<view class="list_name flex_r flex_jb"><text>数</text><text>量</text></view>
|
|
|
- <view class="list_con">{{basicsInfo.buyCount}}</view>
|
|
|
+ <view class="list_con">{{Data.num}}</view>
|
|
|
</view>
|
|
|
- <view class="order_list flex_r flex_ac flex_jb" v-if="Data.goodsType != 2 && Data.goodsType != 5 && Data.goodsType != 4 && Data.goodsType != 3 && Data.goodsType != 7">
|
|
|
+ <view class="order_list flex_r flex_ac flex_jb">
|
|
|
<view class="flex_r flex_ac">
|
|
|
<view class="list_name flex_r flex_jb"><text>运</text><text>费</text></view>
|
|
|
- <view class="list_con p_color">({{basicsInfo.goodsFreightMsg}})</view>
|
|
|
+ <view class="list_con p_color">({{freight}}元/每套)</view>
|
|
|
</view>
|
|
|
- <view class="list_con">¥{{basicsInfo.goodsFreight}}</view>
|
|
|
+ <view class="list_con">¥{{freight}}</view>
|
|
|
</view>
|
|
|
- <view class="order_list flex_r flex_ac flex_jb" v-if="Data.goodsType == 2">
|
|
|
+ <view class="order_list flex_r flex_ac flex_jb" v-if="Data.type == 2">
|
|
|
<view class="flex_r flex_ac">
|
|
|
<view class="list_name flex_r flex_jb"><text>茶</text><text>宝</text></view>
|
|
|
- <view class="list_con p_color">(可用{{basicsInfo.Integral}})</view>
|
|
|
+ <view class="list_con p_color">(可用{{userinfo.cha_bao}})</view>
|
|
|
</view>
|
|
|
<view class="list_con">{{basicsInfo.goodsTeaInt}}茶宝</view>
|
|
|
</view>
|
|
|
- <view class="order_list flex_r flex_ac flex_jb" v-if="Data.goodsType == 2">
|
|
|
+ <view class="order_list flex_r flex_ac flex_jb" v-if="Data.type == 2">
|
|
|
<view class="flex_r flex_ac">
|
|
|
<view class="list_name flex_r flex_jb"><text>批</text><text>发</text><text>积</text><text>分</text></view>
|
|
|
- <view class="list_con p_color">(可用{{basicsInfo.PfIntegral}})</view>
|
|
|
+ <view class="list_con p_color">(可用{{basicsInfo.integral}})</view>
|
|
|
</view>
|
|
|
<view class="list_con">{{basicsInfo.goodsPfInt}}批发积分</view>
|
|
|
</view>
|
|
|
- <view class="order_list flex_r flex_ac flex_jb" v-if="Data.goodsType != 5">
|
|
|
+ <view class="order_list flex_r flex_ac flex_jb" v-if="Data.type != 5">
|
|
|
<view class="list_name flex_r flex_jb"><text>商</text><text>品</text><text>金</text><text>额</text></view>
|
|
|
<view class="list_con">¥{{basicsInfo.goodsTotalPrice}}</view>
|
|
|
</view>
|
|
|
- <view class="order_list flex_r flex_ac flex_jb" v-if="Data.goodsType == 5">
|
|
|
+ <view class="order_list flex_r flex_ac flex_jb" v-if="Data.type == 5">
|
|
|
<view class="list_name flex_r flex_jb"><text>消</text><text>费</text><text>积</text><text>分</text></view>
|
|
|
<view class="list_con">{{basicsInfo.stayPay}}消费积分</view>
|
|
|
</view>
|
|
|
- <view class="order_list flex_r flex_ac flex_jb" v-if="Data.goodsType == 5">
|
|
|
+ <view class="order_list flex_r flex_ac flex_jb" v-if="Data.type == 5">
|
|
|
<view class="list_name flex_r flex_jb"><text>可</text><text>用</text><text>积</text><text>分</text></view>
|
|
|
- <view class="list_con">{{basicsInfo.userXfInt}}消费积分</view>
|
|
|
+ <view class="list_con">{{userinfo.integral}}消费积分</view>
|
|
|
</view>
|
|
|
- <view class="order_list flex_r flex_ac flex_jb" v-if="(!Data.payType || Data.payType == 2 || Data.payType == 6) && Data.goodsType != 7">
|
|
|
+ <view class="order_list flex_r flex_ac flex_jb">
|
|
|
<view class="list_name flex_r flex_jb"><text>可</text><text>用</text><text>余</text><text>额</text></view>
|
|
|
- <view class="list_con p_color">¥{{basicsInfo.userAccount}}</view>
|
|
|
+ <view class="list_con p_color">¥{{userinfo.user_money}}</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
<!-- 订单信息-end -->
|
|
|
|
|
|
<!-- 底部操作栏 -->
|
|
|
<view class="bar flex_r flex_ac flex_jb">
|
|
|
- <view class="bar_info flex_r flex_ac">待支付<text>¥{{basicsInfo.zonPirce}}</text></view>
|
|
|
+ <view class="bar_info flex_r flex_ac">待支付<text>¥{{obligation}}</text></view>
|
|
|
<view class="pay_btn flex_r flex_ac flex_jc" @tap="payment">立即支付</view>
|
|
|
</view>
|
|
|
<!-- 底部操作栏-end -->
|
|
|
@@ -111,25 +111,55 @@ import { get, post, u_post } from "@/request/api.js";
|
|
|
goodsInfo:'', // 商品信息
|
|
|
modularName:'' ,// 商品类型
|
|
|
DefaultAddress: '' ,// 用户默认地址
|
|
|
- basicsInfo:'' // 订单信息
|
|
|
+ basicsInfo:'', // 订单信息
|
|
|
+
|
|
|
+ freight: 0, //运费
|
|
|
+ userinfo: {},
|
|
|
+ obligation: 0, //待支付
|
|
|
};
|
|
|
},
|
|
|
- onLoad:function(e){
|
|
|
+ onLoad(e){
|
|
|
this.Data = e
|
|
|
- this.loadData()
|
|
|
- this.loadAddress()
|
|
|
+ this.loadData(e)
|
|
|
+ // this.loadAddress()
|
|
|
+ this.userinfo = uni.getStorageSync('userinfo');
|
|
|
},
|
|
|
methods:{
|
|
|
- loadData:function(){
|
|
|
- let that = this;
|
|
|
- u_post("ShuZiTeaYW/shop/confirmOrder",this.Data).then(res => {
|
|
|
- if(res.status == 200){
|
|
|
- that.goodsInfo = res.goodsInfo
|
|
|
- that.basicsInfo = res.basicsInfo
|
|
|
- that.modularName = res.modularName
|
|
|
- }
|
|
|
+ loadData(da){
|
|
|
+ post("goods/goodsDetail",da).then(res => {
|
|
|
+ if(res.code === 0){
|
|
|
+ this.goodsInfo = res.data.data
|
|
|
+ post("goods/freight",{type:da.type}).then(res => {
|
|
|
+ if(res.code === 0){
|
|
|
+ this.freight = res.data.freight;
|
|
|
+ }
|
|
|
+ // 计算待支付
|
|
|
+ let a = this.goodsInfo.cost_price * this.Data.num + parseFloat(this.freight);
|
|
|
+ let b = a - this.userinfo.user_money;
|
|
|
+ this.obligation = b > 0 ? b : 0
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ post("user/addressList").then(res => {
|
|
|
+ if(res.code === 0){
|
|
|
+ let da = res.data.data;
|
|
|
+ for (const i of da) {
|
|
|
+ if(i.status == 1) {
|
|
|
+ this.DefaultAddress = i;
|
|
|
+ break;
|
|
|
+ }else this.DefaultAddress = da[0]
|
|
|
+ }
|
|
|
+ }
|
|
|
})
|
|
|
+ // u_post("ShuZiTeaYW/shop/confirmOrder",this.Data).then(res => {
|
|
|
+ // if(res.status == 200){
|
|
|
+ // that.goodsInfo = res.goodsInfo
|
|
|
+ // that.basicsInfo = res.basicsInfo
|
|
|
+ // that.modularName = res.modularName
|
|
|
+ // }
|
|
|
+ // })
|
|
|
},
|
|
|
+
|
|
|
// 获取用户地址
|
|
|
loadAddress:function(){
|
|
|
let that = this;
|
|
|
@@ -139,109 +169,116 @@ import { get, post, u_post } from "@/request/api.js";
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- chooseWXaddress:function() {
|
|
|
- var that = this;
|
|
|
- uni.chooseAddress({
|
|
|
- success: function (res) {
|
|
|
- let default_address = {
|
|
|
- city: res.cityName,
|
|
|
- county: res.countyName,
|
|
|
- address: res.detailInfo,
|
|
|
- zipCode: res.postalCode,
|
|
|
- province: res.provinceName,
|
|
|
- mobile: res.telNumber,
|
|
|
- name: res.userName
|
|
|
- };
|
|
|
- that.DefaultAddress = default_address;
|
|
|
- },
|
|
|
- fail: function (res) {
|
|
|
- console.log(res);
|
|
|
- if (res.errMsg == "chooseAddress:fail auth deny" || res.errMsg == "chooseAddress:fail:auth denied") {
|
|
|
- that.flag = false;
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
+ chooseWXaddress() {
|
|
|
+ this.goto("/pages/xghc-addrress/userAddress");
|
|
|
+ // var that = this;
|
|
|
+ // uni.chooseAddress({
|
|
|
+ // success: function (res) {
|
|
|
+ // let default_address = {
|
|
|
+ // city: res.cityName,
|
|
|
+ // county: res.countyName,
|
|
|
+ // address: res.detailInfo,
|
|
|
+ // zipCode: res.postalCode,
|
|
|
+ // province: res.provinceName,
|
|
|
+ // mobile: res.telNumber,
|
|
|
+ // name: res.userName
|
|
|
+ // };
|
|
|
+ // that.DefaultAddress = default_address;
|
|
|
+ // },
|
|
|
+ // fail: function (res) {
|
|
|
+ // console.log(res);
|
|
|
+ // if (res.errMsg == "chooseAddress:fail auth deny" || res.errMsg == "chooseAddress:fail:auth denied") {
|
|
|
+ // that.flag = false;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // })
|
|
|
},
|
|
|
// 支付
|
|
|
payment:function(){
|
|
|
- let that = this;
|
|
|
- if(this.DefaultAddress == '' && this.Data.ojsType!=2){
|
|
|
- appEv.errTips('请选择地址')
|
|
|
- return false
|
|
|
- }
|
|
|
- let data = {
|
|
|
- goodsType:this.Data.goodsType,
|
|
|
- buyCount:this.Data.count,
|
|
|
- payType:this.Data.payType ? this.Data.payType : 1,
|
|
|
- ojsType:this.Data.ojsType ? this.Data.ojsType : ''
|
|
|
- }
|
|
|
- if(this.Data.goodsType == 6){
|
|
|
- data.shoppingCartId=this.Data.goodsId
|
|
|
- }else if(this.Data.goodsType == 4){
|
|
|
- data.shoppingCartId=this.Data.goodsPId
|
|
|
- }else{
|
|
|
- data.goodsId=this.Data.goodsId
|
|
|
- }
|
|
|
- if(this.Data.ojsType!=2){
|
|
|
- if(this.DefaultAddress.id && this.DefaultAddress.id != ''){
|
|
|
- data.addressId=this.DefaultAddress.id
|
|
|
- }else{
|
|
|
- data = {
|
|
|
- ...data,
|
|
|
- province : this.DefaultAddress.province,
|
|
|
- city : this.DefaultAddress.city,
|
|
|
- county : this.DefaultAddress.county,
|
|
|
- address : this.DefaultAddress.address,
|
|
|
- name : this.DefaultAddress.name,
|
|
|
- mobile : this.DefaultAddress.mobile
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- uni.showModal({
|
|
|
- title: '提示',
|
|
|
- content: '是否确认支付',
|
|
|
- success: function (res) {
|
|
|
- if (res.confirm) {
|
|
|
- let info = null
|
|
|
- if(that.Data.goodsType == 6 || that.Data.goodsType == 4){
|
|
|
- info = reqApi.ShoppingCartBuy(data)
|
|
|
- }else{
|
|
|
- info = reqApi.placeOrders(data)
|
|
|
- }
|
|
|
- if(info){
|
|
|
- info.then(res => {
|
|
|
- if(res.data.status == 200){
|
|
|
- if(res.data.payParam){
|
|
|
- toPayOpre.toPay(res.data.payParam, (res) => {
|
|
|
- if (!res) {
|
|
|
- // 支付成功
|
|
|
- uni.redirectTo({
|
|
|
- url: '/pages/szw-order-list/index'
|
|
|
- })
|
|
|
- } else {
|
|
|
- // 支付失败
|
|
|
- uni.redirectTo({
|
|
|
- url: '/pages/szw-order-list/index'
|
|
|
- })
|
|
|
- }
|
|
|
- });
|
|
|
- }else{
|
|
|
- appEv.errTips('支付成功')
|
|
|
- // 支付成功
|
|
|
- uni.redirectTo({
|
|
|
- url: '/pages/szw-order-list/index'
|
|
|
- })
|
|
|
- }
|
|
|
- }else{
|
|
|
- appEv.errTips(res.data.msg)
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- } else if (res.cancel) {
|
|
|
- console.log('用户点击取消');
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
+ post('goods/submitOrder',{
|
|
|
+ ...this.Data,
|
|
|
+ address_id: this.DefaultAddress.id,
|
|
|
+ }).then(res => {
|
|
|
+
|
|
|
+ })
|
|
|
+ // let that = this;
|
|
|
+ // if(this.DefaultAddress == '' && this.Data.ojsType!=2){
|
|
|
+ // appEv.errTips('请选择地址')
|
|
|
+ // return false
|
|
|
+ // }
|
|
|
+ // let data = {
|
|
|
+ // goodsType:this.Data.goodsType,
|
|
|
+ // buyCount:this.Data.count,
|
|
|
+ // payType:this.Data.payType ? this.Data.payType : 1,
|
|
|
+ // ojsType:this.Data.ojsType ? this.Data.ojsType : ''
|
|
|
+ // }
|
|
|
+ // if(this.Data.goodsType == 6){
|
|
|
+ // data.shoppingCartId=this.Data.goodsId
|
|
|
+ // }else if(this.Data.goodsType == 4){
|
|
|
+ // data.shoppingCartId=this.Data.goodsPId
|
|
|
+ // }else{
|
|
|
+ // data.goodsId=this.Data.goodsId
|
|
|
+ // }
|
|
|
+ // if(this.Data.ojsType!=2){
|
|
|
+ // if(this.DefaultAddress.id && this.DefaultAddress.id != ''){
|
|
|
+ // data.addressId=this.DefaultAddress.id
|
|
|
+ // }else{
|
|
|
+ // data = {
|
|
|
+ // ...data,
|
|
|
+ // province : this.DefaultAddress.province,
|
|
|
+ // city : this.DefaultAddress.city,
|
|
|
+ // county : this.DefaultAddress.county,
|
|
|
+ // address : this.DefaultAddress.address,
|
|
|
+ // name : this.DefaultAddress.name,
|
|
|
+ // mobile : this.DefaultAddress.mobile
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // uni.showModal({
|
|
|
+ // title: '提示',
|
|
|
+ // content: '是否确认支付',
|
|
|
+ // success: function (res) {
|
|
|
+ // if (res.confirm) {
|
|
|
+ // let info = null
|
|
|
+ // if(that.Data.goodsType == 6 || that.Data.goodsType == 4){
|
|
|
+ // info = reqApi.ShoppingCartBuy(data)
|
|
|
+ // }else{
|
|
|
+ // info = reqApi.placeOrders(data)
|
|
|
+ // }
|
|
|
+ // if(info){
|
|
|
+ // info.then(res => {
|
|
|
+ // if(res.data.status == 200){
|
|
|
+ // if(res.data.payParam){
|
|
|
+ // toPayOpre.toPay(res.data.payParam, (res) => {
|
|
|
+ // if (!res) {
|
|
|
+ // // 支付成功
|
|
|
+ // uni.redirectTo({
|
|
|
+ // url: '/pages/szw-order-list/index'
|
|
|
+ // })
|
|
|
+ // } else {
|
|
|
+ // // 支付失败
|
|
|
+ // uni.redirectTo({
|
|
|
+ // url: '/pages/szw-order-list/index'
|
|
|
+ // })
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // }else{
|
|
|
+ // appEv.errTips('支付成功')
|
|
|
+ // // 支付成功
|
|
|
+ // uni.redirectTo({
|
|
|
+ // url: '/pages/szw-order-list/index'
|
|
|
+ // })
|
|
|
+ // }
|
|
|
+ // }else{
|
|
|
+ // appEv.errTips(res.data.msg)
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // }
|
|
|
+ // } else if (res.cancel) {
|
|
|
+ // console.log('用户点击取消');
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // });
|
|
|
|
|
|
}
|
|
|
}
|