Browse Source

修改 微信appid

lilei 4 years ago
parent
commit
4736a5e84f
5 changed files with 29 additions and 33 deletions
  1. 1 1
      manifest.json
  2. 11 25
      pages/getOrder/getOrder.vue
  3. 1 0
      pages/index/index.vue
  4. 9 5
      pages/work/index/index.vue
  5. 7 2
      store/index.js

+ 1 - 1
manifest.json

@@ -57,7 +57,7 @@
     "quickapp" : {},
     /* 小程序特有相关 */
     "mp-weixin" : {
-        "appid" : "wxb6f09597a1545d81",
+        "appid" : "wx3c26d022890f7c2b",
         "setting" : {
             "urlCheck" : false,
             "es6" : true,

+ 11 - 25
pages/getOrder/getOrder.vue

@@ -94,23 +94,7 @@
 				userPhone: '',
 				stepIndex: 0, // 当前步奏下标
 				serverIndex: 0, // 选择服务下标
-				itemList: [ // 服务列表
-					{
-						id: 1,
-						name: '极速快洗',
-						price: 10
-					},
-					{
-						id: 12,
-						name: '精致洗',
-						price: 20
-					},
-					{
-						id: 13,
-						name: '打蜡洗',
-						price: 30
-					}
-				],
+				itemList: [], // 服务类型
 				isRead: '', // 是否同意协议
 				couponList: [
 						{
@@ -166,6 +150,9 @@
 			uni.$once('read', this.read)
 			this.getUserPhone()
 			this.getServerList()
+			// 存储当前扫码的设备及网点id
+			this.$store.state.vuex_orderInfo.bizId = option.bizId || '9898'
+			this.$store.state.vuex_orderInfo.storeId = option.storeId || ''
 		},
 		onUnload() {
 			uni.removeStorageSync('stepIndex')
@@ -295,9 +282,8 @@
 						let data = res.data
 						// 保存成功后 请求预支付返回吊起微信支付所需参数
 						this.getPayData(data)
-						// uni.redirectTo({
-						// 	url:`/pages/work/index/index?washCarType=${data.itemCode}&orderNo=${data.orderNo}`
-						// })
+						this.$store.state.vuex_orderInfo.itemCode = data.itemCode
+						this.$store.state.vuex_orderInfo.orderNo = data.orderNo
 					} else {
 						uni.hideLoading()
 						// 刷新服务项
@@ -307,9 +293,9 @@
 				})
 			},
 			// 预支付 返回微信支付所需参数
-			getPayData (data) {
-				signPay({orderId:data.id}).then(res =>{
-					console.log(res,'11111111')
+			getPayData (orderData) {
+				signPay({orderId:orderData.id}).then(res =>{
+					console.log(res,'预支付')
 					uni.hideLoading()
 					if (res.status == 200) {
 						let data = res.data
@@ -317,7 +303,7 @@
 						if (data.tradeStatus && data.tradeStatus=="PAID") {
 							// 付款成功后开始洗车
 							uni.redirectTo({
-								url:`/pages/work/index/index?washCarType=${data.itemCode}&orderNo=${data.orderNo}`
+								url:`/pages/work/index/index`
 							})
 						} else {
 							uni.requestPayment({
@@ -331,7 +317,7 @@
 							        console.log('success:' + JSON.stringify(res));
 									// 付款成功后开始洗车
 									uni.redirectTo({
-										url:`/pages/work/index/index?washCarType=${data.itemCode}&orderNo=${data.orderNo}`
+										url:`/pages/work/index/index`
 									})
 							    },
 							    fail: function (err) {

+ 1 - 0
pages/index/index.vue

@@ -107,6 +107,7 @@
 			this.mapCtx = uni.createMapContext('map')
 		},
 		onShow() {
+			console.log(this.$store.state.vuex_orderInfo,'vuex_orderInfo')
 		},
 		onLoad() {
 			this.getUserLocation()

+ 9 - 5
pages/work/index/index.vue

@@ -121,14 +121,18 @@ export default {
 	onLoad(options) {
 		// 创建websocket
 		this.$store.commit('$webSocket')
-		this.washCarType = options.washCarType
-		this.orderNo = options.orderNo
+		let orderInfo = this.$store.state.vuex_orderInfo
+		this.washCarType = orderInfo.itemCode
+		this.orderNo = orderInfo.orderNo
 		
 		// 监听消息
 		uni.$on('wsMessage',(e)=>{
 			console.log(e)
 			// 进度消息
 			// 错误消息
+			// 启动成功
+			// 紧急停止成功
+			// 复位成功
 		})
 	},
 	methods: {
@@ -150,9 +154,6 @@ export default {
 		},
 		// 开始启动机器洗车
 		startWashCar(){
-			this.step= 0;
-			this.showStart = true;
-			
 			// 启动命令
 			let cmd = {
 				orderNo: this.orderNo, // 订单编号
@@ -160,6 +161,9 @@ export default {
 				washType: this.washCarType,// 洗车模式
 			}
 			this.$store.commit("$sendWebsocket",JSON.stringify(cmd))
+			
+			this.step= 0;
+			this.showStart = true;
 			// 启动成功
 			setTimeout(() => {
 				this.status = 'working';

+ 7 - 2
store/index.js

@@ -41,8 +41,13 @@ const store = new Vuex.Store({
 		vuex_socket: null,
 		vuex_wsMessageData: '',
 		vuex_heartInterId: null,
-		// 设备信息
-		vuex_bizId: '9898', // 编号
+		// 订单信息
+		vuex_orderInfo: {
+			storeId: '', // 网点id
+			bizId: '', // 设备编号
+			itemCode: '', // 服务类型
+			orderNo: ''// 订单编号
+		}
 	},
 	mutations: {
 		$uStore(state, payload) {