订单付款
This commit is contained in:
parent
05d46a3adf
commit
743c06d3e4
9
mini-app/TodoList.md
Normal file
9
mini-app/TodoList.md
Normal file
@ -0,0 +1,9 @@
|
||||
卖酒小程序:
|
||||
|
||||
应用名称/图标
|
||||
我的页面保留哪些功能
|
||||
商品信息
|
||||
酒庄信息/图标
|
||||
支付回调
|
||||
订单管理
|
||||
退货管理
|
@ -13,9 +13,9 @@ class OrderApis {
|
||||
* @param data
|
||||
* @returns {Promise实例对象}
|
||||
*/
|
||||
createOrders(data) {
|
||||
createOrder(data) {
|
||||
return request.post({
|
||||
url: baseUrl + 'winery/user_orders',
|
||||
url: baseUrl + 'winery/order',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ export const formHeader = {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 接口
|
||||
*/
|
||||
@ -29,6 +30,7 @@ class Xiao4rApis {
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default new Xiao4rApis()
|
||||
|
@ -106,6 +106,7 @@ pages: [
|
||||
'pages/mall/user/user-address',
|
||||
'pages/mall/user/user-address-list',
|
||||
'pages/mall/order/order-list',
|
||||
'pages/mall/order/order-check',
|
||||
'pages/mall/shopping-car/shopping-car-list',
|
||||
'pages/winery/winery-detail'
|
||||
|
||||
|
@ -1,8 +1,50 @@
|
||||
import store from '@/store'
|
||||
import eventHub from './common/eventHub'
|
||||
import userApis from './apis/userApis'
|
||||
|
||||
class AppManager {
|
||||
login(callBack) {
|
||||
let self = this
|
||||
wx.showLoading({ title: '正在连接...', mask: true })
|
||||
wx.login({
|
||||
async success(res) {
|
||||
let req1 = await userApis.getSession(res.code)
|
||||
console.log(req1)
|
||||
if (!req1.data.openid) {
|
||||
self.showToast('登录失败!' + res.errMsg)
|
||||
wx.hideLoading()
|
||||
}
|
||||
self.saveOpenid(req1.data.openid)
|
||||
|
||||
let req2 = await userApis.loginByMini({ openid: self.getOpenid() })
|
||||
|
||||
if (!req1.data.openid) {
|
||||
self.showToast('登录失败!' + res.errMsg)
|
||||
wx.hideLoading()
|
||||
}
|
||||
|
||||
if (req2.token) {
|
||||
store.dispatch('setTokenAction', req2.token)
|
||||
self.setCacheInfo()
|
||||
}
|
||||
|
||||
wx.hideLoading()
|
||||
|
||||
if (callBack) {
|
||||
callBack()
|
||||
}
|
||||
},
|
||||
fail(res) {
|
||||
self.showToast('登录失败,正在重试.')
|
||||
wx.hideLoading()
|
||||
self.login()
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
saveOpenid(openid) {
|
||||
console.log('saveOpenid:' + openid)
|
||||
store.dispatch('setOpenidAction', openid)
|
||||
}
|
||||
|
||||
@ -39,14 +81,11 @@ class AppManager {
|
||||
return
|
||||
}
|
||||
|
||||
console.log('path:', path)
|
||||
|
||||
if (!path) {
|
||||
this.showToast('建设中')
|
||||
return
|
||||
}
|
||||
|
||||
console.log('path:', path)
|
||||
wx.navigateTo({
|
||||
url: path
|
||||
})
|
||||
|
@ -4,8 +4,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
export const baseUrl = 'http://127.0.0.1:18989/'
|
||||
// export const baseUrl = 'http://36.1.51.30:18989/'
|
||||
// export const baseUrl = 'http://127.0.0.1:18989/'
|
||||
export const baseUrl = 'http://36.1.51.30:18989/'
|
||||
// export const baseUrl = 'http://36.1.50.18:18989/winery/'
|
||||
// export const baseUrl = 'http://62.234.123.172:18989/api/'
|
||||
// export const baseUrl = 'https://www.xiao4r.com/wine/winery/'
|
||||
|
@ -192,6 +192,7 @@ import defaultMix from '../../../mixins/defaultMix'
|
||||
import orderApis from '../../../apis/orderApis'
|
||||
import appManager from '../../../appManager'
|
||||
import { navDefine } from '../../../store/constant/navDefine'
|
||||
import xiao4rApis from '../../../apis/xiao4rApis'
|
||||
|
||||
wepy.component({
|
||||
store,
|
||||
@ -223,37 +224,35 @@ wepy.component({
|
||||
appManager.navigateTo(navDefine.SHOPPING_CAR_LIST)
|
||||
return
|
||||
|
||||
let test = {
|
||||
goodsId: '12',
|
||||
goodsName: 'test',
|
||||
goodsType: '1',
|
||||
goodsSpec: 'test',
|
||||
goodsFaceImg: 'test',
|
||||
goodsPrice: 0.1,
|
||||
goodsCount: 1,
|
||||
remark: 'test'
|
||||
}
|
||||
// xiao4rApis.test({
|
||||
//
|
||||
// channel_bs: '28',
|
||||
// clientType: 'mini',
|
||||
// fee: '0.01',
|
||||
// kh: '29000051611',
|
||||
// openId: appManager.getOpenid(),
|
||||
// org_no: '29',
|
||||
// userId: '2475772'
|
||||
//
|
||||
// }).then(r => {
|
||||
// let payData = r.data.payMsg
|
||||
// wx.requestPayment({
|
||||
// appId: payData.appId,
|
||||
// timeStamp: payData.timeStamp,
|
||||
// nonceStr: payData.nonceStr,
|
||||
// package: payData.packageValue,
|
||||
// signType: payData.signType,
|
||||
// paySign: payData.paySign,
|
||||
// success: function(res) {
|
||||
//
|
||||
// },
|
||||
// fail: function(res) {
|
||||
// }
|
||||
// })
|
||||
// })
|
||||
|
||||
orderApis.createOrders(test).then(r => {
|
||||
if (r.code !== 200) {
|
||||
return
|
||||
}
|
||||
|
||||
let payData = r.data.payMsg
|
||||
wx.requestPayment({
|
||||
appId: payData.appId,
|
||||
timeStamp: payData.timeStamp,
|
||||
nonceStr: payData.nonceStr,
|
||||
package: payData.packageValue,
|
||||
signType: payData.signType,
|
||||
paySign: payData.paySign,
|
||||
success: function(res) {
|
||||
|
||||
},
|
||||
fail: function(res) {
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -1,49 +0,0 @@
|
||||
<style lang="less">
|
||||
|
||||
.header {
|
||||
width: 100%;
|
||||
height: 536rpx;
|
||||
z-index: -10;
|
||||
|
||||
|
||||
}
|
||||
|
||||
</style>
|
||||
<template>
|
||||
|
||||
<div>
|
||||
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import wepy from '@wepy/core'
|
||||
import store from '@/store'
|
||||
import { mapActions } from '@wepy/x'
|
||||
|
||||
wepy.component({
|
||||
store,
|
||||
hooks: {
|
||||
},
|
||||
|
||||
data: {
|
||||
active: 0
|
||||
},
|
||||
|
||||
computed: {
|
||||
},
|
||||
|
||||
methods: {
|
||||
|
||||
},
|
||||
|
||||
ready() {
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<config>
|
||||
{
|
||||
navigationBarTitleText: ''
|
||||
}
|
||||
</config>
|
@ -29,9 +29,10 @@ module.exports.parseImage = parseImage;
|
||||
</block>
|
||||
</swiper>
|
||||
|
||||
|
||||
<van-cell :title="goodsItems.goodsName" value="内容能显示多长" label="描述信息描述信息描述信息描述信息描述信息描述信息描述信息描述信息"
|
||||
border="{{ false }}" />
|
||||
<van-cell title="选择规格" is-link @tap="onShowSpec" />
|
||||
<van-cell title="选择下单" is-link @tap="onShowSpec" />
|
||||
|
||||
<div style="margin: 10px 15px;">
|
||||
<span>商品详情</span>
|
||||
@ -49,13 +50,13 @@ module.exports.parseImage = parseImage;
|
||||
bind:close="onCloseSpec"
|
||||
>
|
||||
<van-card
|
||||
:title="goodsSpec.specName"
|
||||
:desc="goods.specDesc"
|
||||
:price="goodsSpec.specPrice"
|
||||
:thumb="filters.parseImage(goodsSpec.specImg)"
|
||||
:title="goodsItem.goodsName"
|
||||
:desc="goodsItem.specDesc"
|
||||
:price="goodsItem.goodsPrice"
|
||||
:thumb="filters.parseImage(goodsItem.goodsFaceImg)"
|
||||
>
|
||||
<view slot="num" style="float:right;">
|
||||
<!-- <div>{{'已优惠¥xx元'}}</div>-->
|
||||
<!-- <div>{{'已优惠¥xx元'}}</div>-->
|
||||
</view>
|
||||
|
||||
</van-card>
|
||||
@ -74,7 +75,8 @@ module.exports.parseImage = parseImage;
|
||||
</van-col>
|
||||
</van-row>
|
||||
|
||||
<van-button round type="danger" size="small" style="float:right;margin-top:10px;margin-right: 10px;">下一步
|
||||
<van-button round type="danger" size="small" style="float:right;margin-top:10px;margin-right: 10px;"
|
||||
@tap="onSubmit()">下一步
|
||||
</van-button>
|
||||
|
||||
</van-popup>
|
||||
@ -93,8 +95,12 @@ module.exports.parseImage = parseImage;
|
||||
<script>
|
||||
import wepy from '@wepy/core'
|
||||
import store from '@/store'
|
||||
import { mapActions } from '@wepy/x'
|
||||
import { mapActions, mapState } from '@wepy/x'
|
||||
import mailApis from '../../apis/mailApis'
|
||||
import orderApis from '../../apis/orderApis'
|
||||
import appManager from '../../appManager'
|
||||
import { navDefine, orderCheck, orderListPage } from '../../store/constant/navDefine'
|
||||
import { defaultOrder } from '../../store/constant/orderDefine'
|
||||
|
||||
wepy.page({
|
||||
store,
|
||||
@ -111,6 +117,9 @@ wepy.page({
|
||||
|
||||
computed: {
|
||||
|
||||
...mapState({
|
||||
'order': state => state.order
|
||||
}),
|
||||
goodsImages() {
|
||||
if (!this.goodsItem || !this.goodsItem.goodsImg) {
|
||||
return []
|
||||
@ -118,12 +127,12 @@ wepy.page({
|
||||
|
||||
return this.goodsItem.goodsImg.split(',')
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
methods: {
|
||||
...mapActions([
|
||||
'setUserAction',
|
||||
'setFormAction'
|
||||
'setOrderAction'
|
||||
]),
|
||||
handleViewTap() {
|
||||
console.log('handleVieTap clicked')
|
||||
@ -152,14 +161,42 @@ wepy.page({
|
||||
const goodsSpecReq = await mailApis.getGoodsSpecByIds(ids)
|
||||
|
||||
this.goodsSpec = goodsSpecReq.rows[0]
|
||||
},
|
||||
|
||||
onSubmit() {
|
||||
console.log(123)
|
||||
// wx.showLoading({ title: '正在生成订单.', mask: true })
|
||||
|
||||
const item = this.goodsItem
|
||||
|
||||
let orderItem = {
|
||||
goodsId: item.id,
|
||||
goodsName: item.goodsName,
|
||||
goodsType: item.goodsType,
|
||||
goodsSpec: item.goodsSpec,
|
||||
goodsFaceImg: item.goodsFaceImg,
|
||||
goodsPrice: item.goodsPrice,
|
||||
goodsCount: this.count
|
||||
}
|
||||
console.log('订单:', item)
|
||||
|
||||
let order = defaultOrder
|
||||
|
||||
defaultOrder.orderDetailList.push(orderItem)
|
||||
|
||||
this.setOrderAction(order)
|
||||
|
||||
appManager.navigateTo(navDefine.ORDER_CHECK)
|
||||
}
|
||||
},
|
||||
|
||||
onLoad(options) {
|
||||
this.init(options.id)
|
||||
},
|
||||
onShow() {
|
||||
console.log(this.order)
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
</script>
|
||||
<config>
|
||||
|
@ -10,6 +10,7 @@
|
||||
width: 30px;
|
||||
height: 20px;
|
||||
}
|
||||
|
||||
page {
|
||||
background-color: #F5F6F7;
|
||||
}
|
||||
@ -111,7 +112,7 @@ wepy.page({
|
||||
store,
|
||||
hooks: {},
|
||||
|
||||
mixins: [ defaultMix ],
|
||||
mixins: [defaultMix],
|
||||
data: {
|
||||
pageIndex: 0
|
||||
},
|
||||
@ -126,7 +127,6 @@ wepy.page({
|
||||
methods: {
|
||||
...mapActions([
|
||||
'setUserAction',
|
||||
'setTokenAction',
|
||||
'setOpenidAction'
|
||||
]),
|
||||
handleViewTap() {
|
||||
@ -143,49 +143,12 @@ wepy.page({
|
||||
this.pageIndex = event.$wx.detail
|
||||
},
|
||||
callAppLaunch() {
|
||||
},
|
||||
login() {
|
||||
let self = this
|
||||
wx.showLoading({ title: '正在连接...', mask: true })
|
||||
wx.login({
|
||||
success(res) {
|
||||
let req = userApis.getSession(res.code)
|
||||
|
||||
req.then(rsp => {
|
||||
if (rsp.data.openid) {
|
||||
self.init(rsp.data.openid)
|
||||
} else {
|
||||
appManager.showToast('登录失败!' + res.errMsg)
|
||||
wx.hideLoading()
|
||||
}
|
||||
}).catch(e => {
|
||||
appManager.showToast('登录失败!' + res.errMsg)
|
||||
})
|
||||
// request.requestTaskMap.get(req.taskId).abort()
|
||||
// console.log('中断请求,req:', req.taskId)
|
||||
},
|
||||
fail(res) {
|
||||
appManager.showToast('登录失败,正在重试.')
|
||||
wx.hideLoading()
|
||||
self.login()
|
||||
}
|
||||
})
|
||||
},
|
||||
async init(openid) {
|
||||
appManager.saveOpenid(openid)
|
||||
|
||||
let rsp = await userApis.loginByMini({ openid: openid })
|
||||
if (rsp.token) {
|
||||
this.setTokenAction(rsp.token)
|
||||
appManager.setCacheInfo()
|
||||
}
|
||||
|
||||
wx.hideLoading()
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
ready() {
|
||||
this.login()
|
||||
appManager.login()
|
||||
},
|
||||
onShow() {
|
||||
}
|
||||
|
213
mini-app/src/pages/mall/order/order-check.wpy
Normal file
213
mini-app/src/pages/mall/order/order-check.wpy
Normal file
@ -0,0 +1,213 @@
|
||||
<style lang="less">
|
||||
page {
|
||||
background-color: #eeeeee;
|
||||
}
|
||||
|
||||
.fream {
|
||||
|
||||
border-radius: 25px;
|
||||
width: 660rpx;
|
||||
margin-top: 20px;
|
||||
background-color: white;
|
||||
//box-shadow: 4px 4px 10px #eeeeee;
|
||||
padding: 10px 10px 10px 10px;
|
||||
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.van-card {
|
||||
|
||||
background-color: white !important;
|
||||
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<wxs module="filters" lang="babel">
|
||||
const parseImage = (imageKey) => {
|
||||
return 'https://winery-1257413599.cos.ap-beijing.myqcloud.com/' + imageKey
|
||||
}
|
||||
module.exports.parseImage = parseImage;
|
||||
</wxs>
|
||||
<template>
|
||||
|
||||
<nav-bar title="确认订单" />
|
||||
|
||||
|
||||
<div class="contianer" style="width: 100%;margin:15px;">
|
||||
<div v-if="!currentAddress" style="display: flex;flex-direction: column;align-items: center;width: 100%;">
|
||||
<van-empty description="您还没有添加收货地址" />
|
||||
<div style="width: 600rpx;">
|
||||
<van-button round type="info" size="large" @tap="onAdd">点击添加</van-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-else class="fream" @tap="onSelectAddress">
|
||||
|
||||
<div style="display: flex; justify-content: space-between;">
|
||||
<van-icon name="home-o" size="60rpx" />
|
||||
<div style="display: flex;flex-direction: column;">
|
||||
<div style="display: flex;align-items: center;">
|
||||
<span style="font-size: 16px;font-weight: bold;">{{currentAddress.name}}</span>
|
||||
<span style="color: #999;font-size: 12px;margin-left: 10px;">{{currentAddress.mobile}}</span>
|
||||
</div>
|
||||
<div style="display: flex; flex-direction: column; font-size: 14px; width: 500rpx;margin-top: 10px;">
|
||||
<span>{{currentAddress.region}}</span>
|
||||
<span style="margin-top: 5px;">{{currentAddress.address}}</span>
|
||||
</div>
|
||||
</div>
|
||||
<van-icon name="arrow" />
|
||||
</div>
|
||||
|
||||
<div style="display: flex; justify-content:flex-end;margin: 10px;">
|
||||
<van-button round size="small" color="#98002E" type="info" plain style="margin-left: 20px;"
|
||||
@tap="onEditAddress()">编辑
|
||||
</van-button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="fream">
|
||||
|
||||
<van-card
|
||||
|
||||
v-for="(item,index) in order.orderDetailList"
|
||||
:title="item.goodsName"
|
||||
:desc="item.specDesc"
|
||||
:price="item.goodsPrice"
|
||||
:thumb="filters.parseImage(item.goodsFaceImg)"
|
||||
>
|
||||
<view slot="num" style="float:right;">
|
||||
<van-stepper id="{{item.goodsId}}" name="{{item.goodsId}}" value="{{item.goodsCount}}" @change="onGoodsCount" />
|
||||
</view>
|
||||
|
||||
</van-card>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<van-submit-bar
|
||||
price="10"
|
||||
button-text="提交订单"
|
||||
bind:submit="onSubmit"
|
||||
:tip="false"
|
||||
>
|
||||
<!-- <view slot="tip">您的收货地址不支持同城送,-->
|
||||
<!-- <text>修改地址</text>-->
|
||||
<!-- </view>-->
|
||||
</van-submit-bar>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import wepy from '@wepy/core'
|
||||
import store from '@/store'
|
||||
|
||||
import { mapActions, mapState } from '@wepy/x'
|
||||
import defaultMix from '../../../mixins/defaultMix'
|
||||
import appManager from '../../../appManager'
|
||||
import addressApis from '../../../apis/addressApis'
|
||||
import { userAddressPage } from '../../../store/constant/nav/home'
|
||||
import orderApis from '../../../apis/orderApis'
|
||||
import { navDefine, orderListPage, userAddressListPage } from '../../../store/constant/navDefine'
|
||||
|
||||
wepy.page({
|
||||
store,
|
||||
hooks: {},
|
||||
data: {
|
||||
currentAddress: null,
|
||||
order: null
|
||||
|
||||
},
|
||||
mixins: [defaultMix],
|
||||
computed: {
|
||||
...mapState({
|
||||
'imageDefine': state => state.imageDefine,
|
||||
'user': state => state.user,
|
||||
'navDefine': state => state.navDefine,
|
||||
'userAddress': state => state.userAddress,
|
||||
'order': state => state.order
|
||||
})
|
||||
},
|
||||
|
||||
methods: {
|
||||
...mapActions([
|
||||
'setOrderAction'
|
||||
]),
|
||||
async init() {
|
||||
const addressRsp = await addressApis.getAddressList()
|
||||
if (addressRsp.code === 200 && addressRsp.rows.length > 0) {
|
||||
this.currentAddress = addressRsp.rows.filter(x => x.isDefault)[0]
|
||||
|
||||
this.order.addressId = this.currentAddress.id
|
||||
this.setOrderAction(this.order)
|
||||
}
|
||||
},
|
||||
|
||||
onSelectAddress() {
|
||||
appManager.navigateTo(userAddressListPage + '?isSelectMode=true')
|
||||
},
|
||||
onEditAddress() {
|
||||
appManager.navigateTo(userAddressPage + '?id=' + this.currentAddress.id)
|
||||
},
|
||||
|
||||
onGoodsCount(e) {
|
||||
this.order.orderDetailList.filter(x => x.goodsId === e.target.goodsId)[0].goodsCount = e.$wx.detail
|
||||
},
|
||||
|
||||
onSubmit() {
|
||||
|
||||
orderApis.createOrder(this.order).then(r => {
|
||||
wx.hideLoading()
|
||||
|
||||
if (r.code !== 200) {
|
||||
return
|
||||
}
|
||||
|
||||
let payData = r.data
|
||||
wx.requestPayment({
|
||||
appId: payData.appId,
|
||||
timeStamp: payData.timeStamp,
|
||||
nonceStr: payData.nonceStr,
|
||||
package: payData.packageValue,
|
||||
signType: payData.signType,
|
||||
paySign: payData.paySign,
|
||||
success: function(res) {
|
||||
wx.showLoading({ title: '正在获取订单信息.', mask: true })
|
||||
setTimeout(() => {
|
||||
wx.hideLoading()
|
||||
appManager.navigateTo(navDefine.ORDER_LIST_PAGE)
|
||||
}, 3000)
|
||||
},
|
||||
fail: function(res) {
|
||||
appManager.showToast('支付失败.')
|
||||
}
|
||||
})
|
||||
}).catch(e => {
|
||||
wx.hideLoading()
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
ready() {
|
||||
this.init()
|
||||
},
|
||||
onShow() {
|
||||
this.init()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<config>
|
||||
{
|
||||
navigationBarTitleText: '',
|
||||
|
||||
usingComponents: {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
</config>
|
@ -128,8 +128,6 @@ wepy.page({
|
||||
this.checkList = this.isCheckedAll ? this.records.map(x => x.goodsId) : []
|
||||
},
|
||||
onGoodsCount(e) {
|
||||
console.log(e)
|
||||
|
||||
this.records.filter(x => x.id === e.target.id)[0].goodsCount = e.$wx.detail
|
||||
},
|
||||
async init() {
|
||||
|
@ -19,9 +19,11 @@
|
||||
color: #333333 !important;
|
||||
|
||||
}
|
||||
|
||||
.van-field__label {
|
||||
color: #333333 !important;
|
||||
}
|
||||
|
||||
.van-field__input--disabled {
|
||||
color: #333333 !important;
|
||||
}
|
||||
@ -53,7 +55,7 @@
|
||||
</div>
|
||||
|
||||
<div v-for="(item,index) in records" class="address-item"
|
||||
:style="{ border: item.isDefault === 1 ? '#AC1630 1px solid' : '#eeeeee 1px solid'}">
|
||||
:style="{ border: item.isDefault === 1 ? '#AC1630 1px solid' : '#eeeeee 1px solid'}" @tap="onSelect(item)">
|
||||
<van-field
|
||||
label="收货人姓名"
|
||||
:value="item.name"
|
||||
@ -80,8 +82,12 @@
|
||||
/>
|
||||
|
||||
<div style="display: flex; justify-content:flex-end;margin: 10px;">
|
||||
<van-button round v-if="item.isDefault !== 1" color="#98002E" size="small" type="info" plain @tap="onSetDefault(item)">设为默认</van-button>
|
||||
<van-button round size="small" color="#98002E" type="info" plain style="margin-left: 20px;" @tap="onEdit(item)">编辑</van-button>
|
||||
<van-button round v-if="item.isDefault !== 1" color="#98002E" size="small" type="info" plain
|
||||
@tap="onSetDefault(item)">设为默认
|
||||
</van-button>
|
||||
<van-button round size="small" color="#98002E" type="info" plain style="margin-left: 20px;"
|
||||
@tap="onEdit(item)">编辑
|
||||
</van-button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@ -105,7 +111,8 @@ wepy.page({
|
||||
hooks: {},
|
||||
data: {
|
||||
records: [],
|
||||
isInit: false
|
||||
isInit: false,
|
||||
isSelectMode: false
|
||||
|
||||
},
|
||||
mixins: [defaultMix],
|
||||
@ -133,6 +140,17 @@ wepy.page({
|
||||
onAdd() {
|
||||
appManager.navigateTo(userAddressPage)
|
||||
},
|
||||
onSelect(item) {
|
||||
if (!this.isSelectMode) {
|
||||
return
|
||||
}
|
||||
|
||||
item.isDefault = 1
|
||||
|
||||
addressApis.editAddress(item).then(r => {
|
||||
this.navBack()
|
||||
})
|
||||
},
|
||||
async init() {
|
||||
this.isInit = false
|
||||
const req = await addressApis.getAddressList()
|
||||
@ -145,9 +163,16 @@ wepy.page({
|
||||
}
|
||||
},
|
||||
|
||||
onLoad(options) {
|
||||
if (options.isSelectMode) {
|
||||
this.isSelectMode = true
|
||||
}
|
||||
},
|
||||
|
||||
ready() {
|
||||
this.init()
|
||||
},
|
||||
|
||||
onShow() {
|
||||
this.init()
|
||||
}
|
||||
|
@ -1,26 +1,28 @@
|
||||
import { imgbaseUrl } from '../../../baseDefine'
|
||||
import { orderListPage, userAddressListPage } from './pages'
|
||||
|
||||
|
||||
export const myMenuList1 = [
|
||||
{
|
||||
name: '全部订单',
|
||||
icon: imgbaseUrl + 'doctor.png',
|
||||
path: '/pages/mall/order/order-list'
|
||||
path: orderListPage
|
||||
},
|
||||
{
|
||||
name: '待付款',
|
||||
icon: imgbaseUrl + 'doctor.png',
|
||||
path: '/pages/mall/order/order-list?orderStatus=1'
|
||||
path: orderListPage + '?orderStatus=1'
|
||||
}, {
|
||||
name: '待收货',
|
||||
icon: imgbaseUrl + 'doctor.png',
|
||||
path: '/pages/mall/order/order-list?orderStatus=2'
|
||||
path: orderListPage + '?orderStatus=2'
|
||||
}
|
||||
]
|
||||
export const myMenuList2 = [
|
||||
{
|
||||
name: '地址管理',
|
||||
icon: imgbaseUrl + 'doctor.png',
|
||||
path: '/pages/mall/user/user-address-list'
|
||||
path: userAddressListPage
|
||||
},
|
||||
{
|
||||
name: '发票管理',
|
||||
|
4
mini-app/src/store/constant/nav/pages.js
Normal file
4
mini-app/src/store/constant/nav/pages.js
Normal file
@ -0,0 +1,4 @@
|
||||
export const shoppingCarList = '/pages/mall/shopping-car/shopping-car-list'
|
||||
export const orderListPage = '/pages/mall/order/order-list'
|
||||
export const orderCheck = '/pages/mall/order/order-check'
|
||||
export const userAddressListPage = '/pages/mall/user/user-address-list'
|
@ -1,5 +1,6 @@
|
||||
import { homeBanner, homeBanner1, homeBanner2, homeHeader, homeMenuList, menu1, menu2 } from './nav/home'
|
||||
import { myMenuList1, myMenuList2, myMenuList3 } from './nav/my'
|
||||
import { orderCheck, orderListPage, shoppingCarList, userAddressListPage } from './nav/pages'
|
||||
|
||||
export const navDefine = {
|
||||
HOME_MENU_LIST: homeMenuList,
|
||||
@ -15,6 +16,9 @@ export const navDefine = {
|
||||
MY_MENU2: myMenuList2,
|
||||
MY_MENU3: myMenuList3,
|
||||
|
||||
SHOPPING_CAR_LIST: '/pages/mall/shopping-car/shopping-car-list'
|
||||
SHOPPING_CAR_LIST: shoppingCarList,
|
||||
ORDER_LIST_PAGE: orderListPage,
|
||||
ORDER_CHECK: orderCheck,
|
||||
USER_ADDRESS_LIST_PAGE: userAddressListPage,
|
||||
|
||||
}
|
||||
|
12
mini-app/src/store/constant/orderDefine.js
Normal file
12
mini-app/src/store/constant/orderDefine.js
Normal file
@ -0,0 +1,12 @@
|
||||
|
||||
export const defaultOrder = {
|
||||
addressId: '',
|
||||
orderDetailList:[],
|
||||
remark: ''
|
||||
}
|
||||
|
||||
export const currentOrder = {
|
||||
addressId: '',
|
||||
orderDetailList:[],
|
||||
remark: ''
|
||||
}
|
@ -4,6 +4,7 @@ import { imageDefine } from './constant/imageDefine'
|
||||
import { navDefine } from './constant/navDefine'
|
||||
import { wineryDefine } from './constant/wineryDefine'
|
||||
import { userAddress } from './constant/userAddress'
|
||||
import { currentOrder } from './constant/orderDefine'
|
||||
|
||||
export default new Vuex.Store({
|
||||
state: {
|
||||
@ -17,6 +18,8 @@ export default new Vuex.Store({
|
||||
token: '',
|
||||
company: '企业名称'
|
||||
},
|
||||
// 订单
|
||||
order: currentOrder,
|
||||
wineryForm,
|
||||
imageDefine,
|
||||
navDefine,
|
||||
@ -42,10 +45,12 @@ export default new Vuex.Store({
|
||||
},
|
||||
setWineryForm(state, form) {
|
||||
state.wineryForm = form
|
||||
},
|
||||
setOrder(state, order) {
|
||||
state.order = order
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
actions: {
|
||||
setUserAction({ commit }, user) {
|
||||
commit('setUser', user)
|
||||
@ -67,6 +72,9 @@ export default new Vuex.Store({
|
||||
},
|
||||
setWineryFormAction({ commit }, form) {
|
||||
commit('setWineryForm', form)
|
||||
},
|
||||
setOrderAction({commit}, order) {
|
||||
commit('setOrder', order)
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user