+
-
+
@@ -36,8 +40,9 @@ module.exports.parseImage = parseImage;
商品详情
-
@@ -76,16 +81,16 @@ module.exports.parseImage = parseImage;
下一步
+ @tap="onSubmit">下一步
-
-
-
-
+
+
+
+
@@ -96,29 +101,29 @@ module.exports.parseImage = parseImage;
import wepy from '@wepy/core'
import store from '@/store'
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'
+import mailApis from '../../../apis/mailApis'
+import { navDefine } from '../../../store/constant/navDefine'
+import appManager from '../../../appManager'
+
+import { shoppingCarList } from '../../../store/constant/nav/pages'
wepy.page({
store,
hooks: {},
data: {
- detail: '
富文本详情
',
-
isShowSpec: false,
count: 1,
goodsItem: null,
- goodsSpec: null
+ goodsSpec: null,
+ submitMode: 'order'
},
computed: {
...mapState({
- 'order': state => state.order
+ 'order': state => state.order,
+ 'shoppingCar': state => state.shoppingCar
}),
goodsImages() {
if (!this.goodsItem || !this.goodsItem.goodsImg) {
@@ -132,7 +137,8 @@ wepy.page({
methods: {
...mapActions([
- 'setOrderAction'
+ 'setOrderAction',
+ 'setShoppingCarAction'
]),
handleViewTap() {
console.log('handleVieTap clicked')
@@ -141,14 +147,16 @@ wepy.page({
},
- onShowSpec() {
+ onShowSpec(mode) {
this.isShowSpec = true
+ this.submitMode = mode
},
onCloseSpec() {
this.isShowSpec = false
},
onChangeCount(e) {
console.log(e)
+ this.count = e.$wx.detail
},
callAppLaunch() {
@@ -156,17 +164,14 @@ wepy.page({
async init(id) {
const goodsReq = await mailApis.getGoodsById(id)
this.goodsItem = goodsReq.data
- const ids = this.goodsItem.goodsSpec.split(',')
- console.log(ids)
- const goodsSpecReq = await mailApis.getGoodsSpecByIds(ids)
+ // const ids = this.goodsItem.goodsSpec.split(',')
+ // console.log(ids)
+ // const goodsSpecReq = await mailApis.getGoodsSpecByIds(ids)
- this.goodsSpec = goodsSpecReq.rows[0]
+ // this.goodsSpec = goodsSpecReq.rows[0]
},
onSubmit() {
- console.log(123)
- // wx.showLoading({ title: '正在生成订单.', mask: true })
-
const item = this.goodsItem
let orderItem = {
@@ -178,15 +183,45 @@ wepy.page({
goodsPrice: item.goodsPrice,
goodsCount: this.count
}
+
+ this.isShowSpec = false
+
+ switch (this.submitMode) {
+ case 'order':
+
+ this.nextOrder(orderItem)
+ break
+
+ case 'shoppingCar':
+ this.addShoppingCar(orderItem)
+ break
+ }
+ },
+
+ nextOrder(item) {
console.log('订单:', item)
- let order = defaultOrder
+ let order = {
+ addressId: '',
+ orderDetailList: [],
+ remark: ''
+ }
- defaultOrder.orderDetailList.push(orderItem)
+ order.orderDetailList.push(item)
this.setOrderAction(order)
appManager.navigateTo(navDefine.ORDER_CHECK)
+ },
+ addShoppingCar(item) {
+ this.shoppingCar.push(item)
+ this.setShoppingCarAction(this.shoppingCar)
+ },
+ onWinery() {
+ appManager.showToast('建设中')
+ },
+ onShppingCar() {
+ appManager.navigateTo(shoppingCarList)
}
},
@@ -203,9 +238,9 @@ wepy.page({
{
navigationBarTitleText: '',
usingComponents: {
-"van-goods-action": "../../vant/goods-action/index",
-"van-goods-action-icon": "../../vant/goods-action-icon/index",
-"van-goods-action-button": "../../vant/goods-action-button/index"
+"van-goods-action": "../../../vant/goods-action/index",
+"van-goods-action-icon": "../../../vant/goods-action-icon/index",
+"van-goods-action-button": "../../../vant/goods-action-button/index"
}
}
diff --git a/mini-app/src/pages/mall/index.wpy b/mini-app/src/pages/mall/index.wpy
index 52050108a..faf2f2882 100644
--- a/mini-app/src/pages/mall/index.wpy
+++ b/mini-app/src/pages/mall/index.wpy
@@ -28,8 +28,8 @@ return `${hour}:${mins}:${sec}.${milli}`;
module.exports.getTime = getTime;
-
-
+
+
@@ -36,70 +30,78 @@ module.exports.parseImage = parseImage;
-
-
+
+
-
-
-
-
- {{currentAddress.name}}
- {{currentAddress.mobile}}
-
-
- {{currentAddress.region}}
- {{currentAddress.address}}
-
+
+
-
-
编辑
-
+
+
+
+
+
+
+ {{currentAddress.name}}
+ {{currentAddress.mobile}}
+
+
+ {{currentAddress.region}}
+ {{currentAddress.address}}
+
+
+
+
+
+
+ 编辑
+
+
+
-
+
+
+ v-for="(item,index) in order.orderDetailList"
+ :title="item.goodsName"
+ :desc="item.specDesc"
+ :price="item.goodsPrice"
+ :thumb="filters.parseImage(item.goodsFaceImg)"
+ >
+
+ 数量:
+
+
-
- v-for="(item,index) in order.orderDetailList"
- :title="item.goodsName"
- :desc="item.specDesc"
- :price="item.goodsPrice"
- :thumb="filters.parseImage(item.goodsFaceImg)"
- >
-
-
-
+
-
-
-
+
+
+
+
+
+
-
-
-
-
-
@@ -113,14 +115,16 @@ 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'
+import { navDefine } from '../../../store/constant/navDefine'
+import { userAddressListPage } from '../../../store/constant/nav/pages'
wepy.page({
store,
hooks: {},
data: {
currentAddress: null,
- order: null
+ order: null,
+ isInit: false
},
mixins: [defaultMix],
@@ -131,7 +135,14 @@ wepy.page({
'navDefine': state => state.navDefine,
'userAddress': state => state.userAddress,
'order': state => state.order
- })
+ }),
+ totalPrice() {
+ let result = 0.0
+ this.order.orderDetailList.forEach(x => {
+ result += (x.goodsPrice * x.goodsCount)
+ })
+ return result * 100
+ }
},
methods: {
@@ -139,7 +150,12 @@ wepy.page({
'setOrderAction'
]),
async init() {
+ this.isInit = false
+
const addressRsp = await addressApis.getAddressList()
+
+ this.isInit = true
+
if (addressRsp.code === 200 && addressRsp.rows.length > 0) {
this.currentAddress = addressRsp.rows.filter(x => x.isDefault)[0]
@@ -156,11 +172,10 @@ wepy.page({
},
onGoodsCount(e) {
- this.order.orderDetailList.filter(x => x.goodsId === e.target.goodsId)[0].goodsCount = e.$wx.detail
+ this.order.orderDetailList.filter(x => x.goodsId === e.target.id)[0].goodsCount = e.$wx.detail
},
onSubmit() {
-
orderApis.createOrder(this.order).then(r => {
wx.hideLoading()
diff --git a/mini-app/src/pages/mall/order/order-list.wpy b/mini-app/src/pages/mall/order/order-list.wpy
index 67f06d39a..f1d49978e 100644
--- a/mini-app/src/pages/mall/order/order-list.wpy
+++ b/mini-app/src/pages/mall/order/order-list.wpy
@@ -21,17 +21,17 @@ module.exports.parseImage = parseImage;
-
-
+
+
-
+
-
-
+
+
-
+
@@ -73,7 +73,7 @@ wepy.page({
methods: {
onChangeTab(e) {
- this.activeTab = e.$wx.event.detail.name
+ this.activeTab = e.$wx.detail.index
},
async init() {
// this.isInit = false
@@ -100,7 +100,8 @@ wepy.page({
navigationBarTitleText: '',
usingComponents: {
-'order-list-body': '../../../components/mall/order/order-list-body'
+'order-list-body': '../../../components/mall/order/order-list-body',
+'order-detail-body': '../../../components/mall/order/order-detail-body'
}
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 9e711fe78..09948b334 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
@@ -20,17 +20,16 @@ module.exports.parseImage = parseImage;
-
+
-
+
@@ -40,8 +39,12 @@ module.exports.parseImage = parseImage;
-
-
+
+
+ 数量:
+
+
@@ -81,14 +84,14 @@ import store from '@/store'
import { mapActions, mapState } from '@wepy/x'
import defaultMix from '../../../mixins/defaultMix'
-import orderApis from '../../../apis/orderApis'
+import { navDefine } from '../../../store/constant/navDefine'
+import appManager from '../../../appManager'
wepy.page({
store,
hooks: {},
data: {
- records: [],
isInit: false,
isCheckedAll: true,
checkList: []
@@ -100,13 +103,15 @@ wepy.page({
'imageDefine': state => state.imageDefine,
'user': state => state.user,
'navDefine': state => state.navDefine,
- 'userAddress': state => state.userAddress
+ 'userAddress': state => state.userAddress,
+ 'shoppingCar': state => state.shoppingCar
+
}),
totalPrice() {
- let temp = this.records.filter(x => this.checkList.indexOf(x.goodsId) > -1)
+ let temp = this.shoppingCar.filter(x => this.checkList.indexOf(x.goodsId) > -1)
let result = 0.0
temp.forEach(x => {
- result += x.goodsPrice
+ result += (x.goodsPrice * x.goodsCount)
})
console.log('总计:', result)
return result * 100
@@ -115,30 +120,39 @@ wepy.page({
events: {},
methods: {
+ ...mapActions([
+ 'setOrderAction',
+ 'setShoppingCarAction'
+ ]),
onChangeCheckbox(e) {
this.checkList = e.$wx.detail
- this.isCheckedAll = this.checkList.length === this.records.length
+ this.isCheckedAll = this.checkList.length === this.shoppingCar.length
},
onSubmit() {
+ let order = {
+ addressId: '',
+ orderDetailList: [],
+ remark: ''
+ }
+ order.orderDetailList = this.shoppingCar
+
+ this.setOrderAction(order)
+
+ appManager.navigateTo(navDefine.ORDER_CHECK)
},
onCheckedAll(e) {
this.isCheckedAll = e.$wx.detail
- this.checkList = this.isCheckedAll ? this.records.map(x => x.goodsId) : []
+ this.checkList = this.isCheckedAll ? this.shoppingCar.map(x => x.goodsId) : []
},
onGoodsCount(e) {
- this.records.filter(x => x.id === e.target.id)[0].goodsCount = e.$wx.detail
+ this.shoppingCar.filter(x => x.goodsId === e.target.id)[0].goodsCount = e.$wx.detail
+ this.setShoppingCarAction(this.shoppingCar)
},
async init() {
this.isInit = false
- const req = await orderApis.getOrderList()
-
- if (req.code === 200) {
- this.records = req.rows
- this.checkList = this.records.map(x => x.goodsId)
- }
-
+ this.checkList = this.shoppingCar.map(x => x.goodsId)
this.isInit = true
}
},
@@ -156,7 +170,6 @@ wepy.page({
navigationBarTitleText: '',
usingComponents: {
-'shopping-car-item': '../../../components/mall/shopping-car/shopping-car-item'
}
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 e5f55c840..5a43790cd 100644
--- a/mini-app/src/pages/mall/user/user-address-list.wpy
+++ b/mini-app/src/pages/mall/user/user-address-list.wpy
@@ -82,7 +82,7 @@
/>
- 设为默认