|
@@ -82,6 +82,7 @@
|
|
|
<script>
|
|
|
import uniSteps from '@/components/uni-steps/uni-steps.vue'
|
|
|
import {getUserInfo} from '@/api/login.js'
|
|
|
+ import {getStoreItems, saveOrder} from '@/api/order.js'
|
|
|
export default {
|
|
|
components: {
|
|
|
uniSteps
|
|
@@ -162,6 +163,7 @@
|
|
|
// 注册全局监听事件
|
|
|
uni.$once('read', this.read)
|
|
|
this.getUserPhone()
|
|
|
+ this.getServerList()
|
|
|
},
|
|
|
onUnload() {
|
|
|
uni.removeStorageSync('stepIndex')
|
|
@@ -188,7 +190,13 @@
|
|
|
},
|
|
|
// 获取服务列表
|
|
|
getServerList () {
|
|
|
-
|
|
|
+ getStoreItems({storeId:100000}).then(res =>{
|
|
|
+ if (res.status == 200) {
|
|
|
+ this.itemList = res.data
|
|
|
+ } else {
|
|
|
+ this.toashMsg(res.message)
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
// 选择服务项目
|
|
|
chooseItem(index) {
|
|
@@ -259,10 +267,30 @@
|
|
|
},
|
|
|
// 去付款
|
|
|
toPay (){
|
|
|
- // 付款成功后开始洗车
|
|
|
- uni.redirectTo({
|
|
|
- url:"/pages/work/index/index"
|
|
|
+ uni.showLoading({
|
|
|
+ title: '请求中...',
|
|
|
+ mask: true
|
|
|
+ })
|
|
|
+ let params = {
|
|
|
+ "itemId": 100000, // 服务id
|
|
|
+ "storeId": 100000, // 门店id
|
|
|
+ "deviceId": 100000, // 设备id
|
|
|
+ "orderTime": this.$u.timeFormat(Date.now(), 'yyyy-mm-dd hh:MM:ss'),
|
|
|
+ "payableAmount": 4, // 应付金额 即优惠前金额
|
|
|
+ "paymentAmount": 4 // 实收金额 即优惠后金额
|
|
|
+ }
|
|
|
+ saveOrder(params).then(res =>{
|
|
|
+ uni.hideLoading()
|
|
|
+ if (res.status==200) {
|
|
|
+ // 付款成功后开始洗车
|
|
|
+ uni.redirectTo({
|
|
|
+ url:"/pages/work/index/index"
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.toashMsg(res.message)
|
|
|
+ }
|
|
|
})
|
|
|
+
|
|
|
}
|
|
|
|
|
|
}
|