diff --git a/mini-app/TodoList.md b/mini-app/TodoList.md
new file mode 100644
index 000000000..b8166fad3
--- /dev/null
+++ b/mini-app/TodoList.md
@@ -0,0 +1,9 @@
+卖酒小程序:
+
+应用名称/图标
+我的页面保留哪些功能
+商品信息
+酒庄信息/图标
+支付回调
+订单管理
+退货管理
diff --git a/mini-app/src/apis/orderApis.js b/mini-app/src/apis/orderApis.js
index 35dd31847..f9222cb54 100644
--- a/mini-app/src/apis/orderApis.js
+++ b/mini-app/src/apis/orderApis.js
@@ -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
})
}
diff --git a/mini-app/src/apis/xiao4rApis.js b/mini-app/src/apis/xiao4rApis.js
index f30619c55..18af10df3 100644
--- a/mini-app/src/apis/xiao4rApis.js
+++ b/mini-app/src/apis/xiao4rApis.js
@@ -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()
diff --git a/mini-app/src/app.wpy b/mini-app/src/app.wpy
index 2dfe37c24..791aa0502 100644
--- a/mini-app/src/app.wpy
+++ b/mini-app/src/app.wpy
@@ -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'
diff --git a/mini-app/src/appManager.js b/mini-app/src/appManager.js
index d5c651068..5fb296719 100644
--- a/mini-app/src/appManager.js
+++ b/mini-app/src/appManager.js
@@ -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
})
diff --git a/mini-app/src/baseDefine.js b/mini-app/src/baseDefine.js
index 7947022f8..80c567fc3 100644
--- a/mini-app/src/baseDefine.js
+++ b/mini-app/src/baseDefine.js
@@ -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/'
diff --git a/mini-app/src/components/mall/tab/mall-home.wpy b/mini-app/src/components/mall/tab/mall-home.wpy
index 8ce674ad8..c6fe3e8cd 100644
--- a/mini-app/src/components/mall/tab/mall-home.wpy
+++ b/mini-app/src/components/mall/tab/mall-home.wpy
@@ -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) {
- }
- })
- })
}
},
diff --git a/mini-app/src/components/user/login.wpy b/mini-app/src/components/user/login.wpy
deleted file mode 100644
index 89d8fe890..000000000
--- a/mini-app/src/components/user/login.wpy
+++ /dev/null
@@ -1,49 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-{
-navigationBarTitleText: ''
-}
-
diff --git a/mini-app/src/pages/mall/goods-detail.wpy b/mini-app/src/pages/mall/goods-detail.wpy
index d1b6687f2..540231f14 100644
--- a/mini-app/src/pages/mall/goods-detail.wpy
+++ b/mini-app/src/pages/mall/goods-detail.wpy
@@ -29,9 +29,10 @@ module.exports.parseImage = parseImage;
+
-
+
商品详情
@@ -49,13 +50,13 @@ module.exports.parseImage = parseImage;
bind:close="onCloseSpec"
>
-
+
@@ -74,7 +75,8 @@ module.exports.parseImage = parseImage;
-
下一步
+ 下一步
@@ -93,8 +95,12 @@ module.exports.parseImage = parseImage;
diff --git a/mini-app/src/pages/mall/index.wpy b/mini-app/src/pages/mall/index.wpy
index 5b6879afd..52050108a 100644
--- a/mini-app/src/pages/mall/index.wpy
+++ b/mini-app/src/pages/mall/index.wpy
@@ -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() {
}
diff --git a/mini-app/src/pages/mall/order/order-check.wpy b/mini-app/src/pages/mall/order/order-check.wpy
new file mode 100644
index 000000000..22137e555
--- /dev/null
+++ b/mini-app/src/pages/mall/order/order-check.wpy
@@ -0,0 +1,213 @@
+
+
+
+const parseImage = (imageKey) => {
+return 'https://winery-1257413599.cos.ap-beijing.myqcloud.com/' + imageKey
+}
+module.exports.parseImage = parseImage;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{currentAddress.name}}
+ {{currentAddress.mobile}}
+
+
+ {{currentAddress.region}}
+ {{currentAddress.address}}
+
+
+
+
+
+
+ 编辑
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+{
+navigationBarTitleText: '',
+
+usingComponents: {
+}
+
+
+}
+
diff --git a/mini-app/src/pages/mall/shopping-car/shopping-car-list.wpy b/mini-app/src/pages/mall/shopping-car/shopping-car-list.wpy
index 622e16496..9e711fe78 100644
--- a/mini-app/src/pages/mall/shopping-car/shopping-car-list.wpy
+++ b/mini-app/src/pages/mall/shopping-car/shopping-car-list.wpy
@@ -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() {
diff --git a/mini-app/src/pages/mall/user/user-address-list.wpy b/mini-app/src/pages/mall/user/user-address-list.wpy
index 44d28e3e1..e5f55c840 100644
--- a/mini-app/src/pages/mall/user/user-address-list.wpy
+++ b/mini-app/src/pages/mall/user/user-address-list.wpy
@@ -19,9 +19,11 @@
color: #333333 !important;
}
+
.van-field__label {
color: #333333 !important;
}
+
.van-field__input--disabled {
color: #333333 !important;
}
@@ -53,7 +55,7 @@
+ :style="{ border: item.isDefault === 1 ? '#AC1630 1px solid' : '#eeeeee 1px solid'}" @tap="onSelect(item)">
- 设为默认
- 编辑
+ 设为默认
+
+ 编辑
+
@@ -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()
}
diff --git a/mini-app/src/store/constant/nav/my.js b/mini-app/src/store/constant/nav/my.js
index feb7d88e2..72ad107c2 100644
--- a/mini-app/src/store/constant/nav/my.js
+++ b/mini-app/src/store/constant/nav/my.js
@@ -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: '发票管理',
diff --git a/mini-app/src/store/constant/nav/pages.js b/mini-app/src/store/constant/nav/pages.js
new file mode 100644
index 000000000..0a249730b
--- /dev/null
+++ b/mini-app/src/store/constant/nav/pages.js
@@ -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'
diff --git a/mini-app/src/store/constant/navDefine.js b/mini-app/src/store/constant/navDefine.js
index fcc29ba10..3f6ae036f 100644
--- a/mini-app/src/store/constant/navDefine.js
+++ b/mini-app/src/store/constant/navDefine.js
@@ -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,
}
diff --git a/mini-app/src/store/constant/orderDefine.js b/mini-app/src/store/constant/orderDefine.js
new file mode 100644
index 000000000..b06cd7e61
--- /dev/null
+++ b/mini-app/src/store/constant/orderDefine.js
@@ -0,0 +1,12 @@
+
+export const defaultOrder = {
+ addressId: '',
+ orderDetailList:[],
+ remark: ''
+}
+
+export const currentOrder = {
+ addressId: '',
+ orderDetailList:[],
+ remark: ''
+}
diff --git a/mini-app/src/store/index.js b/mini-app/src/store/index.js
index 8e3a98201..bba843775 100644
--- a/mini-app/src/store/index.js
+++ b/mini-app/src/store/index.js
@@ -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)
}
}