aXin-0810 9 месяцев назад
Родитель
Сommit
44df031882

+ 93 - 86
src/App.vue

@@ -1,5 +1,5 @@
 <script>
-import Vue from 'vue';
+import Vue from 'vue'
 import {
   getUserInfo,
   getConfigInfo,
@@ -8,92 +8,99 @@ import {
   redirection,
   mini_env,
   getQueryVariable
-} from "@/common/utils/util"
+} from '@/common/utils/util'
 
 import api from '@/common/http/'
 var getUserValTimeId = null
 import store from '@/store/index.js'
 export default {
   async onLaunch() {
+    api
+      .get('/user/user/log', {})
+      .then(res => {})
+      .catch(() => {})
 
-    api.get('/user/user/log', {}).then(res => { }).catch(() => { })
-
-    mini_env((bool) => {
+    mini_env(bool => {
       if (bool) {
-        api.post('/user/open/bindOpenId', {}).then(res => { }).catch(() => { })
+        api
+          .post('/user/open/bindOpenId', {})
+          .then(res => {})
+          .catch(() => {})
       }
     })
 
     // #ifdef MP-WEIXIN
     // 小程序更新
-    const updateManager = uni.getUpdateManager();
+    const updateManager = uni.getUpdateManager()
     // 请求完新版本信息
-    updateManager.onCheckForUpdate((res) => {
+    updateManager.onCheckForUpdate(res => {
       // console.log(res.hasUpdate);
-    });
+    })
     // 新的版本已经下载好
-    updateManager.onUpdateReady((res) => {
+    updateManager.onUpdateReady(res => {
       uni.showModal({
         title: '更新提示',
         content: '新版本已经准备好,是否重启应用?',
         success(res) {
           if (res.confirm) {
             // 调用 applyUpdate 应用新版本并重启
-            updateManager.applyUpdate();
+            updateManager.applyUpdate()
           }
-        },
-      });
-    });
+        }
+      })
+    })
     // 新的版本下载失败
-    updateManager.onUpdateFailed((res) => { });
+    updateManager.onUpdateFailed(res => {})
     // #endif
 
     uni.$on('updateUserInfo', () => {
-      this.updateUserInfo();
-    });
+      this.updateUserInfo()
+    })
 
     uni.getSystemInfo({
       success: function (e) {
-        console.log(e);
-        Vue.prototype.StatusBar = e.statusBarHeight;
+        console.log(e)
+        Vue.prototype.StatusBar = e.statusBarHeight
         // #ifdef MP-WEIXIN
-        let custom = wx.getMenuButtonBoundingClientRect();
-        Vue.prototype.Custom = custom;
-        Vue.prototype.CustomBar = custom.bottom + custom.top - e.statusBarHeight + 4;
+        let custom = wx.getMenuButtonBoundingClientRect()
+        Vue.prototype.Custom = custom
+        Vue.prototype.CustomBar = custom.bottom + custom.top - e.statusBarHeight + 4
         // #endif
         // #ifndef MP-WEIXIN
         Vue.prototype.CustomBar = 48
         // #endif
         //用来判断是否iphoneX类型的全面屏设备
         if (e.model.indexOf('iPhone X') == 0) {
-          Vue.prototype.isIphoneX = 68;
+          Vue.prototype.isIphoneX = 68
         } else {
-          Vue.prototype.isIphoneX = 0;
+          Vue.prototype.isIphoneX = 0
         }
-      },
-    });
+      }
+    })
 
-    this.$setStorage('realAuthUrl', window.location.href.split('#')[0]);
+    this.$setStorage('realAuthUrl', window.location.href.split('#')[0])
 
     // #ifdef MP-WEIXIN
-    this.wxLogin();
+    this.wxLogin()
     // #endif
 
     // #ifdef H5
     webLogin().then(async res => {
       redirection()
       const userInfo = await getUserInfo()
+      console.log(userInfo)
       if (!userInfo.avatar || !userInfo.nickName) {
         let randomNum = new Date().getTime().toString().substr(-6)
         let configInfo = await getConfigInfo()
-        api.post('/user/userinfo/save', {
-          userId: store.state.user.userId,
-          avatarUrl: configInfo.minLogo3,
-          nickName: `微信用户_${randomNum}`
-        })
-        .then(res => {
-          wxConfig(configInfo, res.data)
-        })
+        api
+          .post('/user/userinfo/save', {
+            userId: store.state.user.userId,
+            avatarUrl: configInfo.minLogo3,
+            nickName: `微信用户_${randomNum}`
+          })
+          .then(res => {
+            wxConfig(configInfo, res.data)
+          })
       } else {
         let configInfo = await getConfigInfo()
         wxConfig(configInfo, {
@@ -103,77 +110,77 @@ export default {
       }
 
       // 如果链接带有serviceId,则绑定用户
-      if(getQueryVariable('serviceId')) {
-        api.post('/user/bind', {
-          serviceId: getQueryVariable('serviceId'),
-          userId: store.state.user.userId,
-        }).then(res => {
-        	console.log('绑定成功:' + res.message);
-        })
+      if (getQueryVariable('serviceId')) {
+        api
+          .post('/user/bind', {
+            serviceId: getQueryVariable('serviceId'),
+            userId: store.state.user.userId
+          })
+          .then(res => {
+            console.log('绑定成功:' + res.message)
+          })
       }
     })
-    this.$isResolve();
+    this.$isResolve()
     // #endif
-
-  },
-  onShow: function () {
-
-  },
-  onHide: function () {
-
   },
+  onShow: function () {},
+  onHide: function () {},
   methods: {
     wxLogin() {
       uni.login({
         provider: 'weixin',
-        success: (loginRes) => {
-          this.$api.post('/user/auth', {
-            code: loginRes.code,
-          }).then(async res => {
-            this.$store.commit("user/set_token", res.data.token)
-            this.$store.commit("user/set_openId", res.data.openId)
-            this.$store.commit("user/set_name", res.data.nickName)
-            this.$store.commit("user/set_avatar", res.data.avatar)
-            this.$store.commit("user/set_userId", res.data.userId)
-            if (res.data.mobile) {
-              this.$store.commit("user/set_mobile", res.data.mobile)
-            }
-            if (!res.data.avatar || !res.data.nickName) {
-              await this.saveUserInfo(res.data);
-            }
-            this.$isResolve();
-          }).catch(res => {
-            this.$isReject();
-          })
+        success: loginRes => {
+          this.$api
+            .post('/user/auth', {
+              code: loginRes.code
+            })
+            .then(async res => {
+              this.$store.commit('user/set_token', res.data.token)
+              this.$store.commit('user/set_openId', res.data.openId)
+              this.$store.commit('user/set_name', res.data.nickName)
+              this.$store.commit('user/set_avatar', res.data.avatar)
+              this.$store.commit('user/set_userId', res.data.userId)
+              if (res.data.mobile) {
+                this.$store.commit('user/set_mobile', res.data.mobile)
+              }
+              if (!res.data.avatar || !res.data.nickName) {
+                await this.saveUserInfo(res.data)
+              }
+              this.$isResolve()
+            })
+            .catch(res => {
+              this.$isReject()
+            })
         }
-      });
+      })
     },
 
     // 保存用户信息
     async saveUserInfo(userInfo) {
-      let randomNum = new Date().getTime().toString().substr(-6);
-      let configInfo = await this.$getConfigInfo();
+      let randomNum = new Date().getTime().toString().substr(-6)
+      let configInfo = await this.$getConfigInfo()
       return new Promise((resolve, reject) => {
-        this.$api.post('/user/userinfo/save', {
-          userId: userInfo.userId,
-          avatarUrl: configInfo.minLogo3,
-          nickName: `微信用户_${randomNum}`,
-        }).then(res => {
-          resolve(res.data);
-        })
+        this.$api
+          .post('/user/userinfo/save', {
+            userId: userInfo.userId,
+            avatarUrl: configInfo.minLogo3,
+            nickName: `微信用户_${randomNum}`
+          })
+          .then(res => {
+            resolve(res.data)
+          })
       })
     },
 
-    async updateUserInfo() {
-
-    },
-  },
+    async updateUserInfo() {}
+  }
 }
 </script>
 
 <style lang="scss">
 /*每个页面公共css */
-@import "uview-ui/index.scss";
+@import 'uview-ui/index.scss';
 
-@import "styles/iconfont.css";
+@import 'styles/iconfont.css';
 </style>

+ 150 - 146
src/packageHome/pages/maintenance/applyList.vue

@@ -4,23 +4,25 @@
     :isScroll="true"
     :refresherTriggered="refresherTriggered"
     @refresherrefresh="refresherrefresh"
-    @scrolltolower="scrolltolower">
+    @scrolltolower="scrolltolower"
+  >
     <template slot="header">
       <view class="tab-container">
-      	<u-tabs
-      		:scrollable="true"
-      		:list="tabList"
-      		:current="curTab"
-      		@click="changeTab"
-      		lineColor="#3D8FFD"
-      		:activeStyle="{
-      			color: '#3D8FFD'
-      		}"
-      		:inactiveStyle="{
-      			color: '#666666'
-      		}"
-      		itemStyle="height: 88rpx;">
-      	</u-tabs>
+        <u-tabs
+          :scrollable="true"
+          :list="tabList"
+          :current="curTab"
+          @click="changeTab"
+          lineColor="#3D8FFD"
+          :activeStyle="{
+            color: '#3D8FFD'
+          }"
+          :inactiveStyle="{
+            color: '#666666'
+          }"
+          itemStyle="height: 88rpx;"
+        >
+        </u-tabs>
       </view>
     </template>
 
@@ -28,182 +30,184 @@
       <view class="item" v-for="(item, index) in dataList" :key="index" @tap="toDetail(item)">
         <view class="row">
           <view class="label">申请单号</view>
-          <view class="value">{{item.orderId}}</view>
-          <view class="status">{{item.examineStatus | statusFilter}}</view>
+          <view class="value">{{ item.orderId }}</view>
+          <view class="status">{{ item.examineStatus | statusFilter }}</view>
         </view>
         <view class="row">
           <view class="label">项目名称</view>
-          <view class="value">{{item.rpProjectRepairName}}</view>
+          <view class="value">{{ item.rpProjectRepairName }}</view>
         </view>
         <view class="row">
           <view class="label">工单编号</view>
-          <view class="value">{{item.workerOrderId}}</view>
+          <view class="value">{{ item.workerOrderId }}</view>
         </view>
         <view class="row">
           <view class="label">下单人员</view>
-          <view class="value">{{item.workerName}} {{item.workerMobile}}</view>
+          <view class="value">{{ item.workerName }} {{ item.workerMobile }}</view>
         </view>
         <view class="row">
           <view class="label">下单时间</view>
-          <view class="value">{{item.createTime}}</view>
+          <view class="value">{{ item.createTime }}</view>
         </view>
         <view class="row">
           <view class="label">申请人员</view>
-          <view class="value">{{item.workerName}} {{item.workerMobile}}</view>
+          <view class="value">{{ item.workerName }} {{ item.workerMobile }}</view>
         </view>
         <view class="row">
           <view class="label">申请时间</view>
-          <view class="value">{{item.createTime}}</view>
+          <view class="value">{{ item.createTime }}</view>
         </view>
       </view>
     </view>
     <Loading :loadStatus="loadStatus" :dataList="dataList" />
-
   </zj-page-layout>
   <!-- #endif -->
 
   <!-- #ifndef H5 -->
-  <web-view :src="webViewHref(`/packageHome/pages/maintenance/applyList`, pam, crossPagePam)" @message="crossPage.$listener"></web-view>
+  <web-view
+    :src="webViewHref(`/packageHome/pages/maintenance/applyList`, pam, crossPagePam)"
+    @message="crossPage.$listener"
+  ></web-view>
   <!-- #endif -->
 </template>
 
 <script>
-  // #ifdef H5
-  export default {
-    filters: {
-      statusFilter(val) {
-        const MAP = {
-          WAIT: '待审批',
-          OK: '审批通过',
-          FAIL: '审批驳回',
-          NO: '已取消',
-          PAID: '已现场支付',
-        }
-        return MAP[val];
+// #ifdef H5
+export default {
+  filters: {
+    statusFilter(val) {
+      const MAP = {
+        WAIT: '待审批',
+        OK: '审批通过',
+        FAIL: '审批驳回',
+        NO: '已取消',
+        PAID: '已现场支付',
       }
+      return MAP[val];
+    }
+  },
+
+  data() {
+    return {
+      dataList: [],
+      pageNum: 1,
+      loadStatus: 0,
+      refresherTriggered: false,
+      tabList: [
+      	{key: '', name: '全部', badge: { value: 0 }},
+      	{key: 'WAIT', name: '待审批', badge: { value: 0 }},
+      	{key: 'OK', name: '审批通过', badge: { value: 0 }},
+      	{key: 'FAIL', name: '审批驳回', badge: { value: 0 }},
+      	{key: 'NO', name: '已取消', badge: { value: 0 }},
+      	{key: 'PAID', name: '已现场支付', badge: { value: 0 }},
+      ],
+      tabCurrent: '',
+    }
+  },
+
+  computed:{
+  	curTab() {
+  		return this.tabList.map(item => item.key).indexOf(this.tabCurrent) || 0;
+  	}
+  },
+
+  onLoad() {
+    this.getCount();
+    this.getList();
+
+    this.crossPage.$on('refreshMaintenanceList', () => {
+      this.getCount();
+      this.refreshList();
+    })
+  },
+
+  // onUnload() {
+  //   this.crossPage.$off('refreshMaintenanceList');
+  // },
+
+  methods: {
+    getCount() {
+    	this.$api.post('/engin/material/list/pageCount')
+      .then(res => {
+        if(!res.data) return false;
+    		this.tabList[0].badge.value = res.data.qb || 0;
+    		this.tabList[1].badge.value = res.data.dsp || 0;
+    		this.tabList[2].badge.value = res.data.sptg || 0;
+    		this.tabList[3].badge.value = res.data.spbh || 0;
+    		this.tabList[4].badge.value = res.data.yqx || 0;
+    		this.tabList[5].badge.value = res.data.yxczf || 0;
+    	})
     },
 
-    data() {
-      return {
-        dataList: [],
-        pageNum: 1,
-        loadStatus: 0,
-        refresherTriggered: false,
-        tabList: [
-        	{key: '', name: '全部', badge: { value: 0 }},
-        	{key: 'WAIT', name: '待审批', badge: { value: 0 }},
-        	{key: 'OK', name: '审批通过', badge: { value: 0 }},
-        	{key: 'FAIL', name: '审批驳回', badge: { value: 0 }},
-        	{key: 'NO', name: '已取消', badge: { value: 0 }},
-        	{key: 'PAID', name: '已现场支付', badge: { value: 0 }},
-        ],
-        tabCurrent: '',
-      }
+    getList() {
+    	this.loadStatus = 1;
+    	this.$api.post('/engin/material/list/page', {
+        pageNum: this.pageNum,
+        pageSize: 10,
+        examineStatus: this.tabCurrent
+    	}).then(res => {
+    		this.loadStatus = 0;
+    		let list = res.data.records;
+    		if (list.length < 10) {
+    		  this.loadStatus = 2;
+    		}
+    		this.dataList = this.dataList.concat(list);
+    	}).catch(() => {
+    		this.loadStatus = 2;
+    	}).finally(res => {
+    		this.refresherTriggered = false;
+    	})
     },
 
-    computed:{
-    	curTab() {
-    		return this.tabList.map(item => item.key).indexOf(this.tabCurrent) || 0;
+    refreshList() {
+    	this.dataList = [];
+    	this.pageNum = 1;
+    	this.getList();
+    },
+
+    // 滚动到底部
+    scrolltolower(e) {
+    	if (this.loadStatus === 0) {
+    		this.pageNum++;
+    		this.getList();
     	}
     },
 
-    onLoad() {
+    // 触发下拉刷新
+    refresherrefresh(e) {
+    	this.refresherTriggered = true;
       this.getCount();
-      this.getList();
-
-      this.crossPage.$on('refreshMaintenanceList', () => {
-        this.getCount();
-        this.refreshList();
-      })
+    	this.refreshList();
     },
 
-    // onUnload() {
-    //   this.crossPage.$off('refreshMaintenanceList');
-    // },
-
-    methods: {
-      getCount() {
-      	this.$api.post('/engin/material/list/pageCount')
-        .then(res => {
-          if(!res.data) return false;
-      		this.tabList[0].badge.value = res.data.qb || 0;
-      		this.tabList[1].badge.value = res.data.dsp || 0;
-      		this.tabList[2].badge.value = res.data.sptg || 0;
-      		this.tabList[3].badge.value = res.data.spbh || 0;
-      		this.tabList[4].badge.value = res.data.yqx || 0;
-      		this.tabList[5].badge.value = res.data.yxczf || 0;
-      	})
-      },
-
-      getList() {
-      	this.loadStatus = 1;
-      	this.$api.post('/engin/material/list/page', {
-          pageNum: this.pageNum,
-          pageSize: 10,
-          examineStatus: this.tabCurrent
-      	}).then(res => {
-      		this.loadStatus = 0;
-      		let list = res.data.records;
-      		if (list.length < 10) {
-      		  this.loadStatus = 2;
-      		}
-      		this.dataList = this.dataList.concat(list);
-      	}).catch(() => {
-      		this.loadStatus = 2;
-      	}).finally(res => {
-      		this.refresherTriggered = false;
-      	})
-      },
-
-      refreshList() {
-      	this.dataList = [];
-      	this.pageNum = 1;
-      	this.getList();
-      },
-
-      // 滚动到底部
-      scrolltolower(e) {
-      	if (this.loadStatus === 0) {
-      		this.pageNum++;
-      		this.getList();
-      	}
-      },
-
-      // 触发下拉刷新
-      refresherrefresh(e) {
-      	this.refresherTriggered = true;
-        this.getCount();
-      	this.refreshList();
-      },
-
-      // 切换类型
-      changeTab(item) {
-      	this.tabCurrent = item.key;
-        this.getCount();
-      	this.refreshList();
-      },
-
-      toDetail(item) {
-        this.$navToPage({
-          url: `/packageHome/pages/maintenance/applyDetail?id=${item.orderId}`
-        })
-      }
+    // 切换类型
+    changeTab(item) {
+    	this.tabCurrent = item.key;
+      this.getCount();
+    	this.refreshList();
     },
-  }
 
-  // #endif
-  // #ifndef H5
-  export default {
-    data() {
-      return {
-        pam: {},
-      }
-    },
-    onLoad(pam) {
-      this.pam = pam;
+    toDetail(item) {
+      this.$navToPage({
+        url: `/packageHome/pages/maintenance/applyDetail?id=${item.orderId}`
+      })
     }
+  },
+}
+
+// #endif
+// #ifndef H5
+export default {
+  data() {
+    return {
+      pam: {},
+    }
+  },
+  onLoad(pam) {
+    this.pam = pam;
   }
-  // #endif
+}
+// #endif
 </script>
 
 <style lang="scss" scoped>

+ 106 - 77
src/packageMaterial/pages/apply/pay.vue

@@ -6,12 +6,16 @@
         <view class="materials-container card mt30">
           <view class="title">
             <view class="t1">支付金额</view>
-            <view class="t2">¥<text>{{ detail.totalAmount | priceFilter }}</text></view>
+            <view class="t2"
+              >¥<text>{{ detail.totalAmount | priceFilter }}</text></view
+            >
           </view>
           <view class="id"><text>费用单号:</text>{{ detail.salesId }}</view>
           <view class="product">
             <view class="it" v-for="(item, index) in detail.items" :key="index">
-              <view class="name">{{ item.goodsName }}<text>×{{ item.salesQty }}{{ item.goodsSalesUnit }}</text></view>
+              <view class="name"
+                >{{ item.goodsName }}<text>×{{ item.salesQty }}{{ item.goodsSalesUnit }}</text></view
+              >
               <view class="price">¥{{ item.saleAmount | priceFilter }}</view>
             </view>
             <view class="total">
@@ -48,7 +52,7 @@
 </template>
 
 <script>
-import { weixinPay, mini_env } from '@/common/utils/util.js';
+import { weixinPay, mini_env } from '@/common/utils/util.js'
 export default {
   data() {
     return {
@@ -57,91 +61,108 @@ export default {
       loadStatus: 0,
       errorText: '',
       detail: null,
-      canScanCode: 0,
-    };
+      canScanCode: 0
+    }
   },
 
   onLoad({ orderId }) {
-    this.orderId = orderId;
-    this.getDetail();
+    this.orderId = orderId
+    this.getDetail()
   },
 
   methods: {
     getDetail() {
-      this.$api.post('/material/salses/detail', {
-        salesId: this.orderId
-      }).then(res => {
-        this.detail = res.data;
-        this.loadStatus = 0;
-      }).catch(res => {
-        this.errorText = res.message;
-        this.loadStatus = 2;
-      }).finally(res => {
-        this.refresherTriggered = false;
-      })
+      this.$api
+        .post('/material/salses/detail', {
+          salesId: this.orderId
+        })
+        .then(res => {
+          this.detail = res.data
+          this.loadStatus = 0
+        })
+        .catch(res => {
+          this.errorText = res.message
+          this.loadStatus = 2
+        })
+        .finally(res => {
+          this.refresherTriggered = false
+        })
     },
 
     // 取消订单
     cancelOrder() {
       this.$modal({
         content: '确认取消订单吗?'
-      }).then(() => {
-        this.$api.post('/material/salses/cancel', {
-          salesId: this.orderId
-        }).then(res => {
-          this.$successToast();
-          this.$navToPage({
-            delta: 1
-          }, 'navigateBack')
+      })
+        .then(() => {
+          this.$api
+            .post('/material/salses/cancel', {
+              salesId: this.orderId
+            })
+            .then(res => {
+              this.$successToast()
+              this.$navToPage(
+                {
+                  delta: 1
+                },
+                'navigateBack'
+              )
+            })
         })
-      }).catch(() => { })
+        .catch(() => {})
     },
 
     // 下单
     submitData() {
-      if (this.canScanCode > 0) return this.$toast(`请等待${this.canScanCode}秒后重试`);
-      mini_env((bool) => {
-        this.$api.post('/material/salses/pay', {
-          salesId: this.orderId,
-          ...(() => {
-            if (bool) {
-              return {
-                miniPay: true,
-                openId: this.$store.state.user.miniOpenId
+      if (this.canScanCode > 0) return this.$toast(`请等待${this.canScanCode}秒后重试`)
+      mini_env(bool => {
+        this.$api
+          .post('/material/salses/pay', {
+            salesId: this.orderId,
+            ...(() => {
+              if (bool) {
+                return {
+                  miniPay: true,
+                  openId: this.$store.state.user.miniOpenId
+                }
               }
-            }
-            return {}
-          })()
-        }).then(res => {
-          if (!res.data.isPay) {
-            this.paySuccess();
-          } else {
-            if (bool) {
-              uniWebview.navigateTo({
-                url: `/pages/pay/pay?${Object.entries({
-                  ...res.data,
-                  payPackage: res.data.payPackage.split("=")[0] || "",
-                  payPackageVal: res.data.payPackage.split("=")[1] || ""
-                }).map(item => item.join("=")).join("&")}`
-              })
+              return {}
+            })()
+          })
+          .then(res => {
+            if (!res.data.isPay) {
+              this.paySuccess()
             } else {
-              weixinPay(res.data, function (res) {
-                that.paySuccess();
-              })
-            }
-          }
-        }).catch((res) => {
-          this.$tips(res.message);
-        }).finally(() => {
-          this.canScanCode = 15;
-          let time = setInterval(() => {
-            if (this.canScanCode > 0) {
-              this.canScanCode = this.canScanCode - 1;
-            } else {
-              clearInterval(time);
+              if (bool) {
+                uniWebview.navigateTo({
+                  url: `/pages/pay/pay?${Object.entries({
+                    ...res.data,
+                    payPackage: res.data.payPackage.split('=')[0] || '',
+                    payPackageVal: res.data.payPackage.split('=')[1] || ''
+                  })
+                    .map(item => item.join('='))
+                    .join('&')}`
+                })
+              } else {
+                weixinPay(res.data, function (res) {
+                  that.paySuccess()
+                })
+              }
             }
-          }, 1000);
-        })
+          })
+          .catch(res => {
+            this.$tips(res.message)
+          })
+          .finally(() => {
+            this.canScanCode = 15
+            let time = setInterval(() => {
+              if (this.canScanCode > 0) {
+                this.canScanCode = this.canScanCode - 1
+              } else {
+                clearInterval(time)
+              }
+            }, 1000)
+          })
       })
     },
 
@@ -150,18 +171,26 @@ export default {
         content: '支付成功',
         cancelText: '回到首页',
         confirmText: '查看记录'
-      }).then(() => {
-        this.$navToPage({
-          url: `/packageMaterial/pages/stock/buyRecord`,
-        }, 'reLaunch');
-      }).catch(() => {
-        this.$navToPage({
-          url: `/pages/index/index`,
-        }, 'switchTab');
       })
+        .then(() => {
+          this.$navToPage(
+            {
+              url: `/packageMaterial/pages/stock/buyRecord`
+            },
+            'reLaunch'
+          )
+        })
+        .catch(() => {
+          this.$navToPage(
+            {
+              url: `/pages/index/index`
+            },
+            'switchTab'
+          )
+        })
     }
-  },
-};
+  }
+}
 </script>
 
 <style lang="scss" scoped>

+ 144 - 140
src/packageMaterial/pages/sale/index.vue

@@ -2,30 +2,29 @@
   <!-- #ifdef H5 -->
   <zj-page-layout :hasFooter="true">
     <view class="form-container">
-      <view class="item" @tap="isShowBrandDialog = true">
+      <!-- <view class="item" @tap="isShowBrandDialog = true">
         <view class="label"><text>*</text>品牌</view>
         <view class="picker">
           <text class="value" v-if="brand">{{brand.brandName}}</text>
           <text class="placeholder" v-else>请选择</text>
           <text class="iconfont icon-jinru"></text>
         </view>
-      </view>
+      </view> -->
       <view class="item" v-if="type == 'P'" @tap="isShowCategoryDialog = true">
         <view class="label"><text>*</text>产品大类</view>
         <view class="picker">
-          <text class="value" v-if="category">{{category.name}}</text>
+          <text class="value" v-if="category">{{ category.name }}</text>
           <text class="placeholder" v-else>请选择</text>
           <text class="iconfont icon-jinru"></text>
         </view>
       </view>
-      <view class="item">
+      <!-- <view class="item">
         <view class="label"><text>*</text>销售方式</view>
         <u-radio-group v-model="salesType">
-        	<u-radio shape="circle" label="外购" :name="'OUT'"></u-radio>
-        	<u-radio shape="circle" label="自有仓库" :name="'OWN'"></u-radio>
+          <u-radio shape="circle" label="外购" :name="'OUT'"></u-radio>
+          <u-radio shape="circle" label="自有仓库" :name="'OWN'"></u-radio>
         </u-radio-group>
-      </view>
-
+      </view> -->
       <u-gap height="10" bgColor="#F7F8FF"></u-gap>
       <view class="item">
         <view class="label"><text>*</text>客户电话</view>
@@ -41,18 +40,12 @@
       </view>
       <view class="item">
         <view class="label">工单单号</view>
-        <u--input
-          :readonly="hasOid"
-          placeholder="请输入"
-          border="none"
-          inputAlign="right"
-          v-model="orderNo"
-        ></u--input>
+        <u--input :readonly="hasOid" placeholder="请输入" border="none" inputAlign="right" v-model="orderNo"></u--input>
       </view>
-      <view class="item" @tap="hasOid ? '' : isShowWebsitDialog = true">
+      <view class="item" @tap="hasOid ? '' : (isShowWebsitDialog = true)">
         <view class="label"><text>*</text>所属网点</view>
         <view class="picker">
-          <text class="value" v-if="websit">{{websit.name}}</text>
+          <text class="value" v-if="websit">{{ websit.name }}</text>
           <text class="placeholder" v-else>请选择工单所属网点</text>
           <text class="iconfont icon-jinru"></text>
         </view>
@@ -61,7 +54,10 @@
 
     <template slot="footer">
       <view class="footer-btn-group">
-        <u-button text="历史记录" @click="$navToPage({url: `/packageMaterial/pages/sale/orderList?type=${type}`})"></u-button>
+        <u-button
+          text="历史记录"
+          @click="$navToPage({ url: `/packageMaterial/pages/sale/orderList?type=${type}` })"
+        ></u-button>
         <u-button type="primary" text="选择产品" @click="toChooseProduct"></u-button>
       </view>
     </template>
@@ -75,7 +71,8 @@
       :list="brandList"
       :keyName="'brandName'"
       @cancel="isShowBrandDialog = false"
-      @confirm="confirmBrandDialog">
+      @confirm="confirmBrandDialog"
+    >
     </zjDialogPicker>
 
     <zjDialogPicker
@@ -87,7 +84,8 @@
       :list="categoryList"
       :keyName="'name'"
       @cancel="isShowCategoryDialog = false"
-      @confirm="confirmCategoryDialog">
+      @confirm="confirmCategoryDialog"
+    >
     </zjDialogPicker>
 
     <zjDialogPicker
@@ -99,148 +97,154 @@
       :list="websitList"
       :keyName="'name'"
       @cancel="isShowWebsitDialog = false"
-      @confirm="confirmWebsitDialog">
+      @confirm="confirmWebsitDialog"
+    >
     </zjDialogPicker>
   </zj-page-layout>
   <!-- #endif -->
 
   <!-- #ifndef H5 -->
-  <web-view :src="webViewHref(`/packageMaterial/pages/sale/index`, pam, crossPagePam)" @message="crossPage.$listener"></web-view>
+  <web-view
+    :src="webViewHref(`/packageMaterial/pages/sale/index`, pam, crossPagePam)"
+    @message="crossPage.$listener"
+  ></web-view>
   <!-- #endif -->
 </template>
 
 <script>
-  // #ifdef H5
-	import zjDialogPicker from "@/components/zj-dialog/zj-dialog-picker.vue";
+ // #ifdef H5
+import zjDialogPicker from "@/components/zj-dialog/zj-dialog-picker.vue";
 
-  export default {
-    components: {
-    	zjDialogPicker
-    },
+ export default {
+   components: {
+   	zjDialogPicker
+   },
 
-    data() {
-      return {
-        hasOid: false,
-        wbId: null, // 维保工单
-        wbIsAllFee: null, // 维保工单是否包含全部费用
-        wbPayType: null, // 维保工单费用支付方式
+   data() {
+     return {
+       hasOid: false,
+       wbId: null, // 维保工单
+       wbIsAllFee: null, // 维保工单是否包含全部费用
+       wbPayType: null, // 维保工单费用支付方式
 
-        type: 'M',
-        userMobile: '',
-        orderNo: '',
-        salesType: 'OUT',
-        brand: null,
-        brandList: [],
-        isShowBrandDialog: false,
-        category: null,
-        categoryList: [],
-        isShowCategoryDialog: false,
-        websit: null,
-        websitList: [],
-        isShowWebsitDialog: false,
-      }
-    },
+       type: 'M',
+       userMobile: '',
+       orderNo: '',
+       salesType: 'OUT',
+       brand: null,
+       brandList: [],
+       isShowBrandDialog: false,
+       category: null,
+       categoryList: [],
+       isShowCategoryDialog: false,
+       websit: null,
+       websitList: [],
+       isShowWebsitDialog: false,
+     }
+   },
 
-    onLoad({type, oid = ''}) {
-      this.type = type;
-      this.hasOid = oid.length > 0;
+   onLoad({type, oid = ''}) {
+     this.type = type;
+     this.hasOid = oid.length > 0;
 
-      uni.setNavigationBarTitle({
-       title: type == 'M' ? '辅材收款' : '配件收款'
-      })
-      this.getBrandList();
-      this.getWebsitList();
-      if(type == 'P') {
-        this.getCategoryList();
-      }
-      if(this.hasOid) {
-        this.$api.post('/pg/order/base/detail', {
-          orderBaseId: oid,
-        }).then((res) => {
-          const data = res.data;
-          this.orderNo = oid;
-          this.userMobile = data.userMobile;
-          this.websit = {
-            websitId: data.websitId,
-            name: data.websitName,
-          }
-          if(data.pgOrderProducts && data.pgOrderProducts.length > 0) {
-            this.brand = {
-              id: data.pgOrderProducts[0].brandId,
-              brandName: data.pgOrderProducts[0].brandName
-            }
-          }
-          this.wbId = data.rpProjectRepairId || '';
-          this.wbIsAllFee = data.isAllFee || '';
-          this.wbPayType = data.feePayMethod || '';
-        })
-      }
-    },
+     uni.setNavigationBarTitle({
+      title: type == 'M' ? '辅材收款' : '配件收款'
+     })
+     this.getBrandList();
+     this.getWebsitList();
+     if(type == 'P') {
+       this.getCategoryList();
+     }
+     if(this.hasOid) {
+       this.$api.post('/pg/order/base/detail', {
+         orderBaseId: oid,
+       }).then((res) => {
+         const data = res.data;
+         this.orderNo = oid;
+         this.userMobile = data.userMobile;
+         this.websit = {
+           websitId: data.websitId,
+           name: data.websitName,
+         }
+         if(data.pgOrderProducts && data.pgOrderProducts.length > 0) {
+           this.brand = {
+             id: data.pgOrderProducts[0].brandId,
+             brandName: data.pgOrderProducts[0].brandName
+           }
+         }
+         this.wbId = data.rpProjectRepairId || '';
+         this.wbIsAllFee = data.isAllFee || '';
+         this.wbPayType = data.feePayMethod || '';
+       })
+     }
+   },
 
-    methods: {
-      getBrandList() {
-        this.$api.post('/pay/getBrand')
-        .then(res => {
-          this.brandList = res.data;
-        })
-      },
+   methods: {
+     getBrandList() {
+       this.$api.post('/pay/getBrand')
+       .then(res => {
+         this.brandList = res.data;
+       })
+     },
 
-      getCategoryList() {
-        this.$api.post('/pay/getCategoryList')
-        .then(res => {
-          this.categoryList = res.data;
-        })
-      },
+     getCategoryList() {
+       this.$api.post('/pay/getCategoryList')
+       .then(res => {
+         this.categoryList = res.data;
+       })
+     },
 
-      getWebsitList() {
-        this.$api.get('/user/apply/websit')
-        .then(res => {
-          this.websitList = res.data;
-        })
-      },
+     getWebsitList() {
+       this.$api.get('/user/apply/websit')
+       .then(res => {
+         this.websitList = res.data;
+       })
+     },
 
-      confirmBrandDialog(e) {
-        this.brand = this.brandList[e[0]];
-        this.isShowBrandDialog = false;
-      },
+     confirmBrandDialog(e) {
+       this.brand = this.brandList[e[0]];
+       this.isShowBrandDialog = false;
+     },
 
-      confirmCategoryDialog(e) {
-        this.category = this.categoryList[e[0]];
-        this.isShowCategoryDialog = false;
-      },
+     confirmCategoryDialog(e) {
+       this.category = this.categoryList[e[0]];
+       this.isShowCategoryDialog = false;
+     },
 
-      confirmWebsitDialog(e) {
-        this.websit = this.websitList[e[0]];
-        this.isShowWebsitDialog = false;
-      },
+     confirmWebsitDialog(e) {
+       this.websit = this.websitList[e[0]];
+       this.isShowWebsitDialog = false;
+     },
 
-      toChooseProduct() {
-        if(!this.brand) return this.$toast('请选择品牌');
-        if(this.type == 'P' && !this.category) return this.$toast('请选择产品大类');
-        if(!this.websit) return this.$toast('请选择所属网点');
-        if(!this.userMobile) return this.$toast('请输入客户电话');
-        if(!(/^1[3456789]\d{9}$/.test(this.userMobile)) || this.userMobile.length != 11) return this.$toast('请填写正确的客户电话');
+     toChooseProduct() {
+      //  if(!this.brand) return this.$toast('请选择品牌');
+       if(this.type == 'P' && !this.category) return this.$toast('请选择产品大类');
+       if(!this.websit) return this.$toast('请选择所属网点');
+       if(!this.userMobile) return this.$toast('请输入客户电话');
+       if(!(/^1[3456789]\d{9}$/.test(this.userMobile)) || this.userMobile.length != 11) return this.$toast('请填写正确的客户电话');
+      //  this.$navToPage({
+      //    url: `/packageMaterial/pages/sale/product?type=${this.type}&brandId=${this.brand.id}&brandName=${this.brand.brandName}&categoryId=${this.type=='P'?this.category.categoryId:''}&categoryName=${this.type=='P'?this.category.name:''}&salesType=${this.salesType}&userMobile=${this.userMobile}&orderNo=${this.orderNo}&websitId=${this.websit.websitId}&websitName=${this.websit.name}&wbId=${this.wbId||''}&wbIsAllFee=${this.wbIsAllFee||''}&wbPayType=${this.wbPayType||''}`
+      //  })
+       this.$navToPage({
+         url: `/packageMaterial/pages/sale/product?type=${this.type}&categoryId=${this.type=='P'?this.category.categoryId:''}&categoryName=${this.type=='P'?this.category.name:''}&userMobile=${this.userMobile}&orderNo=${this.orderNo}&websitId=${this.websit.websitId}&websitName=${this.websit.name}&wbId=${this.wbId||''}&wbIsAllFee=${this.wbIsAllFee||''}&wbPayType=${this.wbPayType||''}`
+       })
+     },
+   },
+ }
 
-        this.$navToPage({
-          url: `/packageMaterial/pages/sale/product?type=${this.type}&brandId=${this.brand.id}&brandName=${this.brand.brandName}&categoryId=${this.type=='P'?this.category.categoryId:''}&categoryName=${this.type=='P'?this.category.name:''}&salesType=${this.salesType}&userMobile=${this.userMobile}&orderNo=${this.orderNo}&websitId=${this.websit.websitId}&websitName=${this.websit.name}&wbId=${this.wbId||''}&wbIsAllFee=${this.wbIsAllFee||''}&wbPayType=${this.wbPayType||''}`
-        })
-      },
-    },
-  }
-
-  // #endif
-  // #ifndef H5
-  export default {
-    data() {
-      return {
-        pam: {},
-      }
-    },
-    onLoad(pam) {
-      this.pam = pam;
-    }
-  }
-  // #endif
+ // #endif
+ // #ifndef H5
+ export default {
+   data() {
+     return {
+       pam: {},
+     }
+   },
+   onLoad(pam) {
+     this.pam = pam;
+   }
+ }
+ // #endif
 </script>
 
 <style lang="scss" scoped>

+ 166 - 157
src/packageMaterial/pages/sale/order.vue

@@ -5,12 +5,14 @@
       <view class="common-title">产品信息</view>
       <view class="product-container card">
         <view class="it" v-for="(item, index) in goodsList" :key="index">
-          <view class="name">{{item.goodsName}}<text>×{{item.num}}{{item.goodsUnit}}</text></view>
-          <view class="price">¥{{(item.goodsAmount * item.num) | priceFilter}}</view>
+          <view class="name"
+            >{{ item.goodsName }}<text>×{{ item.num }}{{ item.goodsUnit }}</text></view
+          >
+          <view class="price">¥{{ (item.goodsAmount * item.num) | priceFilter }}</view>
         </view>
         <view class="total">
           <view class="text">合计:</view>
-          <view class="price">¥{{totalPrice | priceFilter}}</view>
+          <view class="price">¥{{ totalPrice | priceFilter }}</view>
         </view>
       </view>
 
@@ -18,17 +20,14 @@
         <view class="common-title">服务费用</view>
         <view class="form-container card">
           <view class="item" v-for="(item, index) in serviceList" :key="index">
-            <view class="label">{{item.goodsName}}<text>×{{item.num}}</text></view>
-            <u--input
-              placeholder="请输入单价"
-              border="none"
-              inputAlign="right"
-              v-model="item.goodsAmount"
-            ></u--input>
+            <view class="label"
+              >{{ item.goodsName }}<text>×{{ item.num }}</text></view
+            >
+            <u--input placeholder="请输入单价" border="none" inputAlign="right" v-model="item.goodsAmount"></u--input>
           </view>
           <view class="total">
             <view class="text">合计:</view>
-            <view class="price">¥{{totalServicePrice | priceFilter}}</view>
+            <view class="price">¥{{ totalServicePrice | priceFilter }}</view>
           </view>
         </view>
       </block>
@@ -37,18 +36,24 @@
       <view class="remark-container card">
         <u--textarea v-model="remark" placeholder="请输入内容" border="none" autoHeight></u--textarea>
       </view>
-
     </view>
 
     <template slot="footer">
       <view class="bottom-container">
         <view class="left">
-          <view class="text">共{{totalNum}}件,合计:</view>
-          <view class="price" v-if="type == 'P' && serviceList.length > 0">¥{{(totalPrice + totalServicePrice) | priceFilter}}</view>
-          <view class="price" v-else>¥{{totalPrice | priceFilter}}</view>
+          <view class="text">共{{ totalNum }}件,合计:</view>
+          <view class="price" v-if="type == 'P' && serviceList.length > 0"
+            >¥{{ (totalPrice + totalServicePrice) | priceFilter }}</view
+          >
+          <view class="price" v-else>¥{{ totalPrice | priceFilter }}</view>
         </view>
         <view class="btn">
-          <u-button type="primary" text="确认订单" @click="submitData(1)" v-if="!wbId || (wbId && wbIsAllFee == 'NO' && wbPayType == 'SITE')"></u-button>
+          <u-button
+            type="primary"
+            text="确认订单"
+            @click="submitData(1)"
+            v-if="!wbId || (wbId && wbIsAllFee == 'NO' && wbPayType == 'SITE')"
+          ></u-button>
           <u-button type="primary" text="提交申请" @click="submitData(2)" v-else></u-button>
         </view>
       </view>
@@ -57,172 +62,176 @@
   <!-- #endif -->
 
   <!-- #ifndef H5 -->
-  <web-view :src="webViewHref(`/packageMaterial/pages/sale/order`, pam, crossPagePam)" @message="crossPage.$listener"></web-view>
+  <web-view
+    :src="webViewHref(`/packageMaterial/pages/sale/order`, pam, crossPagePam)"
+    @message="crossPage.$listener"
+  ></web-view>
   <!-- #endif -->
 </template>
 
 <script>
-  // #ifdef H5
-  export default {
-    data() {
-      return {
-        type: 'M',
-        userMobile: '',
-        orderNo: '',
-        salesType: 'OUT',
-        brandId: null,
-        brandName: null,
-        categoryId: null,
-        categoryName: null,
-        websitId: null,
-        websitName: null,
-        wbId: null, // 维保工单
-        wbIsAllFee: null, // 维保工单是否包含全部费用
-        wbPayType: null, // 维保工单费用支付方式
-        goodsList: [],
-        serviceList: [],
+// #ifdef H5
+export default {
+  data() {
+    return {
+      type: 'M',
+      userMobile: '',
+      orderNo: '',
+      // salesType: 'OUT',
+      salesType: null,
+      brandId: null,
+      brandName: null,
+      categoryId: null,
+      categoryName: null,
+      websitId: null,
+      websitName: null,
+      wbId: null, // 维保工单
+      wbIsAllFee: null, // 维保工单是否包含全部费用
+      wbPayType: null, // 维保工单费用支付方式
+      goodsList: [],
+      serviceList: [],
 
-        remark: '',
-      }
-    },
+      remark: '',
+    }
+  },
 
-    computed: {
-      totalNum() {
-        // let val = 0;
-        // this.goodsList.forEach(item => {
-        //   val = val + item.num;
-        // })
-        return this.goodsList.length;
-      },
-      totalPrice() {
-        let val = 0;
-        this.goodsList.forEach(item => {
-          val = val + (item.num * (item.goodsAmount * 100) / 100);
-        })
-        return  val;
-      },
-      totalServicePrice() {
-        let val = 0;
-        this.serviceList.forEach(item => {
-          val = val + (item.num * (item.goodsAmount * 100) / 100);
-        })
-        return  val;
-      },
+  computed: {
+    totalNum() {
+      // let val = 0;
+      // this.goodsList.forEach(item => {
+      //   val = val + item.num;
+      // })
+      return this.goodsList.length;
+    },
+    totalPrice() {
+      let val = 0;
+      this.goodsList.forEach(item => {
+        val = val + (item.num * (item.goodsAmount * 100) / 100);
+      })
+      return  val;
     },
+    totalServicePrice() {
+      let val = 0;
+      this.serviceList.forEach(item => {
+        val = val + (item.num * (item.goodsAmount * 100) / 100);
+      })
+      return  val;
+    },
+  },
 
-    onLoad() {
-      let data = this.$getStorage('materialSaleData');
-      if(data) {
-        this.type = data.type;
-        this.userMobile = data.userMobile;
-        this.orderNo = data.orderNo;
-        this.salesType = data.salesType;
-        this.brandId = data.brandId;
-        this.brandName = data.brandName;
-        this.categoryId = data.categoryId;
-        this.categoryName = data.categoryName;
-        this.websitId = data.websitId;
-        this.websitName = data.websitName;
-        this.wbId = data.wbId;
-        this.wbIsAllFee = data.wbIsAllFee;
-        this.wbPayType = data.wbPayType;
-        if(this.type == 'P') {
-          this.goodsList = data.goodsList.filter(o => o.normType == 'M');
-          this.serviceList = data.goodsList.filter(o => o.normType == 'S');
-          this.serviceList.forEach(o => {
-            o.goodsAmount = '';
-          })
-        }else {
-          this.goodsList = data.goodsList;
-        }
+  onLoad() {
+    let data = this.$getStorage('materialSaleData');
+    if(data) {
+      this.type = data.type;
+      this.userMobile = data.userMobile;
+      this.orderNo = data.orderNo;
+      // this.salesType = data.salesType;
+      // this.brandId = data.brandId;
+      // this.brandName = data.brandName;
+      this.categoryId = data.categoryId;
+      this.categoryName = data.categoryName;
+      this.websitId = data.websitId;
+      this.websitName = data.websitName;
+      this.wbId = data.wbId;
+      this.wbIsAllFee = data.wbIsAllFee;
+      this.wbPayType = data.wbPayType;
+      if(this.type == 'P') {
+        this.goodsList = data.goodsList.filter(o => o.normType == 'M');
+        this.serviceList = data.goodsList.filter(o => o.normType == 'S');
+        this.serviceList.forEach(o => {
+          o.goodsAmount = '';
+        })
+      }else {
+        this.goodsList = data.goodsList;
       }
-      this.$removeStorage('materialSaleData');
+    }
+    this.$removeStorage('materialSaleData');
 
-    },
+  },
 
-    methods: {
+  methods: {
 
 
-      confirmPartsDialog(e) {
-        this.parts = this.partsList[e[0]];
-        this.isShowPartsDialog = false;
-      },
+    confirmPartsDialog(e) {
+      this.parts = this.partsList[e[0]];
+      this.isShowPartsDialog = false;
+    },
 
-      submitData(type) {
-        let serviceList = JSON.parse(JSON.stringify(this.serviceList));
-        if(this.type == 'P') {
-          for(let i = 0; i < serviceList.length; i++) {
-            if(!serviceList[i].goodsAmount && serviceList[i].goodsAmount !== 0) {
-              return this.$toast('请输入服务费用价格');
-            }
+    submitData(type) {
+      let serviceList = JSON.parse(JSON.stringify(this.serviceList));
+      if(this.type == 'P') {
+        for(let i = 0; i < serviceList.length; i++) {
+          if(!serviceList[i].goodsAmount && serviceList[i].goodsAmount !== 0) {
+            return this.$toast('请输入服务费用价格');
           }
-          serviceList.forEach(item => {
-            item.normAmount = Number(item.goodsAmount);
-          })
         }
-        let goodsList = [
-          ...JSON.parse(JSON.stringify(this.goodsList)),
-          ...serviceList
-        ];
+        serviceList.forEach(item => {
+          item.normAmount = Number(item.goodsAmount);
+        })
+      }
+      let goodsList = [
+        ...JSON.parse(JSON.stringify(this.goodsList)),
+        ...serviceList
+      ];
 
-        let url = '', params = {};
-        if(type == 1) {
-          if(this.wbId) {
-            url = '/engin/material/buy';
-            params.rpMaterialOrderItemList = goodsList;
-          }else {
-            url = '/pay/buy';
-            params.workerOrderItems = goodsList;
-          }
-        }
-        else {
-          url = '/engin/material/apply';
+      let url = '', params = {};
+      if(type == 1) {
+        if(this.wbId) {
+          url = '/engin/material/buy';
           params.rpMaterialOrderItemList = goodsList;
+        }else {
+          url = '/pay/buy';
+          params.workerOrderItems = goodsList;
         }
+      }
+      else {
+        url = '/engin/material/apply';
+        params.rpMaterialOrderItemList = goodsList;
+      }
 
-        this.$api.postJson(url, {
-          goodsType: this.type,
-          brand: this.brandName,
-          remark: this.remark,
-          userMobile: this.userMobile,
-          settlementType: this.salesType,
-          workerOrderId: this.orderNo,
-          categoryId: this.categoryId || '',
-          categoryName: this.categoryName || '',
-          websitId: this.websitId,
-          websitName: this.websitName,
-          ...params,
-        }).then(res => {
-          if(type == 1) {
+      this.$api.postJson(url, {
+        // brand: this.brandName,
+        settlementType: this.salesType,
+        goodsType: this.type,
+        remark: this.remark,
+        userMobile: this.userMobile,
+        workerOrderId: this.orderNo,
+        categoryId: this.categoryId || '',
+        categoryName: this.categoryName || '',
+        websitId: this.websitId,
+        websitName: this.websitName,
+        ...params,
+      }).then(res => {
+        if(type == 1) {
+          this.$navToPage({
+            url: `/packageMaterial/pages/sale/pay?handleOrderId=${res.data}&wbId=${this.wbId}`
+          })
+        } else {
+          this.$successToast();
+          setTimeout(() => {
             this.$navToPage({
-              url: `/packageMaterial/pages/sale/pay?handleOrderId=${res.data}&wbId=${this.wbId}`
-            })
-          } else {
-            this.$successToast();
-            setTimeout(() => {
-              this.$navToPage({
-                url: `/packageHome/pages/maintenance/applyList`
-              }, 'reLaunch')
-            }, 500)
-          }
-        })
-      },
+              url: `/packageHome/pages/maintenance/applyList`
+            }, 'reLaunch')
+          }, 500)
+        }
+      })
     },
-  }
+  },
+}
 
-  // #endif
-  // #ifndef H5
-  export default {
-    data() {
-      return {
-        pam: {},
-      }
-    },
-    onLoad(pam) {
-      this.pam = pam;
+// #endif
+// #ifndef H5
+export default {
+  data() {
+    return {
+      pam: {},
     }
+  },
+  onLoad(pam) {
+    this.pam = pam;
   }
-  // #endif
+}
+// #endif
 </script>
 
 <style lang="scss" scoped>

+ 334 - 313
src/packageMaterial/pages/sale/pay.vue

@@ -1,162 +1,181 @@
 <template>
   <view>
-    <Loading
-    	:type="3"
-    	:loadStatus="loadStatus"
-    	:showText="errorText"
-    />
+    <Loading :type="3" :loadStatus="loadStatus" :showText="errorText" />
     <zj-page-layout :hasFooter="true" v-if="detail">
-    	<view style="padding: 1rpx 30rpx">
-    		<view class="materials-container card mt30">
-    			<view class="title">
-    				<view class="t1">支付金额</view>
-    				<view class="t2">¥<text>{{detail.totalAmount | priceFilter}}</text></view>
-    			</view>
-    			<view class="id"><text>订单号:</text>{{detail.orderId}}</view>
-    			<view class="product">
-    			  <view class="it" v-for="(item, index) in wbId ? detail.rpMaterialOrderItems : detail.workerOrderItems" :key="index">
-    			    <view class="name">{{item.goodsName}}<text>×{{item.num}}{{item.unit}}</text></view>
-    			    <view class="price">¥{{item.totalAmount | priceFilter}}</view>
-    			  </view>
-    			  <view class="total">
-    			    <view class="text">合计:</view>
-    			    <view class="price">¥{{detail.totalAmount | priceFilter}}</view>
-    			  </view>
-    			</view>
-    			<view class="row"><text>备注:</text>{{detail.remark}}</view>
-    			<view class="row"><text>操作人:</text>{{detail.workerName}}</view>
-    		</view>
-
-    		<view class="pay-container card mt30">
-    			<view class="top">请选择客户支付方式</view>
-    			<view class="item" @tap="payType = 1">
-    				<view class="left">
-    					<text class="iconfont icon-weixinzhifu" style="color: #43c93e;"></text>
-    					<text class="text">微信支付</text>
-    				</view>
-    				<view class="right">
-    					<text class="iconfont" :class="payType === 1 ? 'icon-danxuan2 active' : 'icon-danxuan'"></text>
-    				</view>
-    			</view>
-    			<view class="item" @tap="payType = 2">
-    				<view class="left">
-    					<text class="iconfont icon-xianxiazhifu" style="color: #0379FF;"></text>
-    					<text class="text">线下支付</text>
-    				</view>
-    				<view class="right">
-    					<text class="iconfont" :class="payType === 2 ? 'icon-danxuan2 active' : 'icon-danxuan'"></text>
-    				</view>
-    			</view>
-    		</view>
-    	</view>
-
-    	<template slot="footer">
-    		<view class="footer-btn-group">
-    			<u-button text="取消订单" @click="cancelOrder"></u-button>
-    			<u-button text="扫码支付" type="primary" @click="scanCode" v-if="payType === 1"></u-button>
-    			<u-button text="确定支付" type="primary" @click="confirmPay" v-else></u-button>
-    		</view>
-    	</template>
+      <view style="padding: 1rpx 30rpx">
+        <view class="materials-container card mt30">
+          <view class="title">
+            <view class="t1">支付金额</view>
+            <view class="t2"
+              >¥<text>{{ detail.totalAmount | priceFilter }}</text></view
+            >
+          </view>
+          <view class="id"><text>订单号:</text>{{ detail.orderId }}</view>
+          <view class="product">
+            <view
+              class="it"
+              v-for="(item, index) in wbId ? detail.rpMaterialOrderItems : detail.workerOrderItems"
+              :key="index"
+            >
+              <view class="name"
+                >{{ item.goodsName }}<text>×{{ item.num }}{{ item.unit }}</text></view
+              >
+              <view class="price">¥{{ item.totalAmount | priceFilter }}</view>
+            </view>
+            <view class="total">
+              <view class="text">合计:</view>
+              <view class="price">¥{{ detail.totalAmount | priceFilter }}</view>
+            </view>
+          </view>
+          <view class="row"><text>备注:</text>{{ detail.remark }}</view>
+          <view class="row"><text>操作人:</text>{{ detail.workerName }}</view>
+        </view>
+
+        <!-- <view class="pay-container card mt30">
+          <view class="top">请选择客户支付方式</view>
+          <view class="item" @tap="payType = 1">
+            <view class="left">
+              <text class="iconfont icon-weixinzhifu" style="color: #43c93e"></text>
+              <text class="text">微信支付</text>
+            </view>
+            <view class="right">
+              <text class="iconfont" :class="payType === 1 ? 'icon-danxuan2 active' : 'icon-danxuan'"></text>
+            </view>
+          </view>
+          <view class="item" @tap="payType = 2">
+            <view class="left">
+              <text class="iconfont icon-xianxiazhifu" style="color: #0379ff"></text>
+              <text class="text">线下支付</text>
+            </view>
+            <view class="right">
+              <text class="iconfont" :class="payType === 2 ? 'icon-danxuan2 active' : 'icon-danxuan'"></text>
+            </view>
+          </view>
+        </view> -->
+      </view>
+
+      <template slot="footer">
+        <view class="footer-btn-group">
+          <u-button text="取消订单" @click="cancelOrder"></u-button>
+          <u-button text="扫码支付" type="primary" @click="scanCode"></u-button>
+          <!-- <u-button text="扫码支付" type="primary" @click="scanCode" v-if="payType === 1"></u-button> -->
+          <!-- <u-button text="确定支付" type="primary" @click="confirmPay" v-else></u-button> -->
+        </view>
+      </template>
     </zj-page-layout>
   </view>
 </template>
 
 <script>
-  import { wxScanCode } from '@/common/utils/util.js';
-
-	export default {
-		data() {
-			return {
-        orderId: null,
-        wbId: null,
-        refresherTriggered: false,
-        loadStatus: 0,
-				errorText: '',
-        detail: null,
-				canScanCode: 0,
-        timeout: null,
-        timeoutNum: 0,
-
-        payType: 1,
-			};
-		},
-
-		onLoad({handleOrderId, wbId}) {
-      this.orderId = handleOrderId;
-      this.wbId = wbId;
-			this.getDetail();
-
-      this.crossPage.$on('reScanCode', () => {
-        this.scanCode();
-      });
-		},
-
-    onUnload() {
-      clearTimeout(this.timeout);
+import { wxScanCode } from '@/common/utils/util.js'
+
+export default {
+  data() {
+    return {
+      orderId: null,
+      wbId: null,
+      refresherTriggered: false,
+      loadStatus: 0,
+      errorText: '',
+      detail: null,
+      canScanCode: 0,
+      timeout: null,
+      timeoutNum: 0,
+
+      payType: 1
+    }
+  },
+
+  onLoad({ handleOrderId, wbId }) {
+    this.orderId = handleOrderId
+    this.wbId = wbId
+    this.getDetail()
+
+    this.crossPage.$on('reScanCode', () => {
+      this.scanCode()
+    })
+  },
+
+  onUnload() {
+    clearTimeout(this.timeout)
+  },
+
+  methods: {
+    getDetail() {
+      let url = '',
+        params = {}
+      if (this.wbId) {
+        url = '/engin/material/detail'
+        params.id = this.orderId
+      } else {
+        url = '/pay/getOrder'
+        params.orderId = this.orderId
+      }
+      this.$api
+        .post(url, params)
+        .then(res => {
+          this.detail = res.data
+          this.loadStatus = 0
+        })
+        .catch(res => {
+          this.errorText = res.message
+          this.loadStatus = 2
+        })
+        .finally(res => {
+          this.refresherTriggered = false
+        })
     },
 
-		methods: {
-      getDetail() {
-        let url = '', params = {};
-        if(this.wbId) {
-          url = '/engin/material/detail';
-          params.id = this.orderId;
-        }else {
-          url = '/pay/getOrder';
-          params.orderId = this.orderId;
-        }
-        this.$api.post(url, params).then(res => {
-          this.detail = res.data;
-          this.loadStatus = 0;
-        }).catch(res => {
-        	this.errorText = res.message;
-        	this.loadStatus = 2;
-        }).finally(res => {
-        	this.refresherTriggered = false;
+    // 取消订单
+    cancelOrder() {
+      this.$modal({
+        content: '确认取消订单吗?'
+      })
+        .then(() => {
+          this.$api
+            .post('/pay/cancel', {
+              orderId: this.orderId
+            })
+            .then(res => {
+              this.$successToast()
+              this.$navToPage(
+                {
+                  delta: 1
+                },
+                'navigateBack'
+              )
+            })
         })
-      },
-
-			// 取消订单
-			cancelOrder() {
-				this.$modal({
-				  content: '确认取消订单吗?'
-				}).then(() => {
-				  this.$api.post('/pay/cancel', {
-				    orderId: this.orderId
-				  }).then(res => {
-				    this.$successToast();
-            this.$navToPage({
-            	delta: 1
-            }, 'navigateBack')
-				  })
-				}).catch(() => {})
-			},
-
-			// 扫码
-			async scanCode() {
-				if (this.canScanCode > 0) return this.$toast(`请等待${this.canScanCode}秒后重试`);
-        var codeVal = await wxScanCode();
-        this.submitData(codeVal);
-			},
-
-			// 下单
-			submitData(code) {
-        let url = '';
-        if(this.wbId) {
-          url = '/engin/material/paid';
-        }else {
-          url = '/pay/paid';
-        }
+        .catch(() => {})
+    },
+
+    // 扫码
+    async scanCode() {
+      if (this.canScanCode > 0) return this.$toast(`请等待${this.canScanCode}秒后重试`)
+      var codeVal = await wxScanCode()
+      this.submitData(codeVal)
+    },
 
-				this.$api.post(url, {
+    // 下单
+    submitData(code) {
+      let url = ''
+      if (this.wbId) {
+        url = '/engin/material/paid'
+      } else {
+        url = '/pay/paid'
+      }
+
+      this.$api
+        .post(url, {
           authCode: code,
           orderId: this.orderId,
           payType: 'WECHAT'
-				}).then((res) => {
+        })
+        .then(res => {
           // 返回true,则支付成功
-					if(res.data) {
-            this.timeoutNum = 0;
-            clearTimeout(this.timeout);
+          if (res.data) {
+            this.timeoutNum = 0
+            clearTimeout(this.timeout)
 
             this.$navToPage({
               url: `/packageMaterial/pages/sale/result?handleOrderId=${this.orderId}&result=1&wbId=${this.wbId || ''}`
@@ -164,51 +183,53 @@
           }
           // 返回false,轮询3次
           else {
-            if(this.timeoutNum < 4) {
-              this.timeoutNum = this.timeoutNum + 1;
+            if (this.timeoutNum < 4) {
+              this.timeoutNum = this.timeoutNum + 1
               this.timeout = setTimeout(() => {
-                this.submitData(code);
-              }, 1000);
-            }else {
-              this.timeoutNum = 0;
-              clearTimeout(this.timeout);
+                this.submitData(code)
+              }, 1000)
+            } else {
+              this.timeoutNum = 0
+              clearTimeout(this.timeout)
               this.$navToPage({
                 url: `/packageMaterial/pages/sale/result?handleOrderId=${this.orderId}&result=0&wbId=${this.wbId || ''}`
               })
             }
           }
-				})
-				.catch((res) => {
-          this.timeoutNum = 0;
-          clearTimeout(this.timeout);
-					this.$tips(res.message);
-				})
-				.finally(() => {
-					this.canScanCode = 15;
-					let time = setInterval(() => {
-						if (this.canScanCode > 0) {
-							this.canScanCode = this.canScanCode - 1;
-						} else {
-							clearInterval(time);
-						}
-					}, 1000);
-				});
-			},
-
-      confirmPay() {
-        let url = '';
-        if(this.wbId) {
-          url = '/engin/material/paid';
-        }else {
-          url = '/pay/paid';
-        }
+        })
+        .catch(res => {
+          this.timeoutNum = 0
+          clearTimeout(this.timeout)
+          this.$tips(res.message)
+        })
+        .finally(() => {
+          this.canScanCode = 15
+          let time = setInterval(() => {
+            if (this.canScanCode > 0) {
+              this.canScanCode = this.canScanCode - 1
+            } else {
+              clearInterval(time)
+            }
+          }, 1000)
+        })
+    },
+
+    confirmPay() {
+      let url = ''
+      if (this.wbId) {
+        url = '/engin/material/paid'
+      } else {
+        url = '/pay/paid'
+      }
 
-        this.$api.post(url, {
+      this.$api
+        .post(url, {
           authCode: '',
           orderId: this.orderId,
           payType: 'LINE'
-        }).then((res) => {
-          if(res.data) {
+        })
+        .then(res => {
+          if (res.data) {
             this.$navToPage({
               url: `/packageMaterial/pages/sale/result?handleOrderId=${this.orderId}&result=1&wbId=${this.wbId || ''}`
             })
@@ -218,142 +239,142 @@
             })
           }
         })
-      },
-		},
-	};
+    }
+  }
+}
 </script>
 
 <style lang="scss" scoped>
-	.card {
-    @include zj-card;
-	}
-
-	.materials-container {
-		padding: 30rpx;
-
-		.title {
-			text-align: center;
-			margin-top: 30rpx;
-
-			.t1 {
-				font-size: 32rpx;
-				font-weight: 500;
-			}
-
-			.t2 {
-				font-size: 40rpx;
-				color: $minor-color;
-				margin-top: 20rpx;
-
-				text {
-					font-size: 56rpx;
-					font-weight: 500;
-				}
-			}
-		}
-
-		.id {
-			margin-top: 50rpx;
-
-			text {
-				color: $sec-font;
-			}
-		}
-
-		.product {
-		  background: #f5f5f5;
-		  border-radius: 12rpx;
-		  padding: 20rpx;
-		  margin-top: 20rpx;
-		  .it {
-		    display: flex;
-		    align-items: flex-end;
-		    margin-bottom: 20rpx;
-		    .name {
-		      flex: 1;
-		      font-size: 28rpx;
-		      font-weight: 500;
-		      text {
-		        color: $sec-font;
-		        margin-left: 12rpx;
-		        font-weight: normal;
-		      }
-		    }
-		    .price {
-		      margin-left: 30rpx;
-		      font-size: 28rpx;
-		      font-weight: 500;
-		    }
-		  }
-		  .total {
-		    display: flex;
-		    align-items: center;
-		    justify-content: flex-end;
-		    margin-top: 30rpx;
-		    .text {
-		      font-size: 28rpx;
-		      color: $sec-font;
-		    }
-		    .price {
-		      font-size: 28rpx;
-		      color: $minor-color;
-		      font-weight: 500;
-		    }
-		  }
-		}
-
-		.row {
-			margin-top: 20rpx;
-			line-height: 40rpx;
-			display: flex;
-      font-size: 28rpx;
-
-			text {
-				color: $sec-font;
-				flex-shrink: 0;
-				line-height: 40rpx;
-			}
-		}
-	}
-
-	.pay-container {
-		padding: 30rpx;
-
-		.top {
-			margin-bottom: 40rpx;
-		}
-
-		.item {
-			display: flex;
-			align-items: center;
-			justify-content: space-between;
-			margin: 30rpx 0;
-
-			.left {
-				display: flex;
-				align-items: center;
-
-				.iconfont {
-					font-size: 44rpx;
-					color: #43c93e;
-				}
-
-				.text {
-					margin-left: 18rpx;
-					font-size: 32rpx;
-				}
-			}
-
-			.right {
-				.iconfont {
-					font-size: 40rpx;
-					color: $sec-font;
-
-					&.active {
-						color: $theme-color;
-					}
-				}
-			}
-		}
-	}
+.card {
+  @include zj-card;
+}
+
+.materials-container {
+  padding: 30rpx;
+
+  .title {
+    text-align: center;
+    margin-top: 30rpx;
+
+    .t1 {
+      font-size: 32rpx;
+      font-weight: 500;
+    }
+
+    .t2 {
+      font-size: 40rpx;
+      color: $minor-color;
+      margin-top: 20rpx;
+
+      text {
+        font-size: 56rpx;
+        font-weight: 500;
+      }
+    }
+  }
+
+  .id {
+    margin-top: 50rpx;
+
+    text {
+      color: $sec-font;
+    }
+  }
+
+  .product {
+    background: #f5f5f5;
+    border-radius: 12rpx;
+    padding: 20rpx;
+    margin-top: 20rpx;
+    .it {
+      display: flex;
+      align-items: flex-end;
+      margin-bottom: 20rpx;
+      .name {
+        flex: 1;
+        font-size: 28rpx;
+        font-weight: 500;
+        text {
+          color: $sec-font;
+          margin-left: 12rpx;
+          font-weight: normal;
+        }
+      }
+      .price {
+        margin-left: 30rpx;
+        font-size: 28rpx;
+        font-weight: 500;
+      }
+    }
+    .total {
+      display: flex;
+      align-items: center;
+      justify-content: flex-end;
+      margin-top: 30rpx;
+      .text {
+        font-size: 28rpx;
+        color: $sec-font;
+      }
+      .price {
+        font-size: 28rpx;
+        color: $minor-color;
+        font-weight: 500;
+      }
+    }
+  }
+
+  .row {
+    margin-top: 20rpx;
+    line-height: 40rpx;
+    display: flex;
+    font-size: 28rpx;
+
+    text {
+      color: $sec-font;
+      flex-shrink: 0;
+      line-height: 40rpx;
+    }
+  }
+}
+
+.pay-container {
+  padding: 30rpx;
+
+  .top {
+    margin-bottom: 40rpx;
+  }
+
+  .item {
+    display: flex;
+    align-items: center;
+    justify-content: space-between;
+    margin: 30rpx 0;
+
+    .left {
+      display: flex;
+      align-items: center;
+
+      .iconfont {
+        font-size: 44rpx;
+        color: #43c93e;
+      }
+
+      .text {
+        margin-left: 18rpx;
+        font-size: 32rpx;
+      }
+    }
+
+    .right {
+      .iconfont {
+        font-size: 40rpx;
+        color: $sec-font;
+
+        &.active {
+          color: $theme-color;
+        }
+      }
+    }
+  }
+}
 </style>

+ 260 - 245
src/packageMaterial/pages/sale/product.vue

@@ -9,30 +9,39 @@
           placeholder="输入分类名称进行搜索"
           v-model="keyword"
           @search="searchData"
-          @clear="searchData">
+          @clear="searchData"
+        >
         </u-search>
       </view>
     </template>
 
     <view class="main-container">
       <view class="left-list" v-if="type == 'M'">
-      	<block v-for="(item, index) in leftList" :key='index'>
-      		<view class="item ellipsis" :class="leftCurrent == item.categoryId ? 'current':''" @tap="changeLeft(item.categoryId)">{{item.categoryName}}</view>
-      	</block>
+        <block v-for="(item, index) in leftList" :key="index">
+          <view
+            class="item ellipsis"
+            :class="leftCurrent == item.categoryId ? 'current' : ''"
+            @tap="changeLeft(item.categoryId)"
+            >{{ item.categoryName }}</view
+          >
+        </block>
       </view>
       <view class="right-list">
         <scroll-view scroll-y style="height: 100%">
-          <view class="item" v-for="(item, index) in rightList" :key='index'>
-            <view class="name">{{item.goodsName}}</view>
-            <view class="text">代码:{{item.goodsCode}}</view>
+          <view class="item" v-for="(item, index) in rightList" :key="index">
+            <view class="name">{{ item.goodsName }}</view>
+            <view class="text">代码:{{ item.goodsCode }}</view>
             <view class="bottom">
-              <view class="price">¥{{item.goodsAmount | priceFilter}}<text>/{{item.goodsUnit}}</text></view>
+              <view class="price"
+                >¥{{ item.goodsAmount | priceFilter }}<text>/{{ item.goodsUnit }}</text></view
+              >
               <u-number-box
                 min="0"
                 :step="item.goodsUnit == '米' ? 1 : 1"
                 :name="item.goodsId"
                 v-model="item.num"
-                @change="changeNum">
+                @change="changeNum"
+              >
                 <view slot="minus" class="ctrl">
                   <u-icon name="minus" color="#FFFFFF" size="12"></u-icon>
                 </view>
@@ -43,7 +52,7 @@
                     inputAlign="center"
                     border="none"
                     v-model="item.num"
-                    @blur="changeNum({name: item.goodsId, value: item.num, unit: item.goodsUnit})"
+                    @blur="changeNum({ name: item.goodsId, value: item.num, unit: item.goodsUnit })"
                   ></u--input>
                 </text>
                 <view slot="plus" class="ctrl">
@@ -69,17 +78,20 @@
         <view class="right" @tap="clearCart"><text class="iconfont icon-shanchu"></text>清空购物车</view>
       </view>
       <view class="list">
-        <view class="item" v-for="(item, index) in cartList" :key='index'>
-          <view class="name">{{item.goodsName}}</view>
+        <view class="item" v-for="(item, index) in cartList" :key="index">
+          <view class="name">{{ item.goodsName }}</view>
           <view class="bottom">
-            <view class="price">¥{{item.goodsAmount | priceFilter}}<text>/{{item.goodsUnit}}</text></view>
+            <view class="price"
+              >¥{{ item.goodsAmount | priceFilter }}<text>/{{ item.goodsUnit }}</text></view
+            >
             <u-number-box
               :step="item.goodsUnit == '米' ? 1 : 1"
               :min="item.goodsUnit == '米' ? 0.1 : 1"
               :name="item.goodsId"
               v-model="item.num"
               @change="changeCartNum"
-              @overlimit="overlimitFun(index)">
+              @overlimit="overlimitFun(index)"
+            >
               <view slot="minus" class="ctrl">
                 <u-icon name="minus" color="#FFFFFF" size="12"></u-icon>
               </view>
@@ -90,7 +102,7 @@
                   inputAlign="center"
                   border="none"
                   v-model="item.num"
-                  @blur="changeCartNum({name: item.goodsId, value: item.num, unit: item.goodsUnit})"
+                  @blur="changeCartNum({ name: item.goodsId, value: item.num, unit: item.goodsUnit })"
                 ></u--input>
               </text>
               <view slot="plus" class="ctrl">
@@ -108,7 +120,7 @@
           <text class="iconfont icon-gouwuche1"></text>
           <u-badge max="99" :value="totalNum" :offset="[1, 1]" absolute></u-badge>
         </view>
-        <view class="price"><text>合计:</text>¥{{totalPrice | priceFilter}}</view>
+        <view class="price"><text>合计:</text>¥{{ totalPrice | priceFilter }}</view>
         <view class="btn">
           <u-button type="primary" text="提交" @click="submitData"></u-button>
         </view>
@@ -118,257 +130,260 @@
   <!-- #endif -->
 
   <!-- #ifndef H5 -->
-  <web-view :src="webViewHref(`/packageMaterial/pages/sale/product`, pam, crossPagePam)" @message="crossPage.$listener"></web-view>
+  <web-view
+    :src="webViewHref(`/packageMaterial/pages/sale/product`, pam, crossPagePam)"
+    @message="crossPage.$listener"
+  ></web-view>
   <!-- #endif -->
 </template>
 
 <script>
-  // #ifdef H5
-  export default {
-    data() {
-      return {
-        type: 'M',
-        userMobile: '',
-        orderNo: '',
-        salesType: 'OUT',
-        brandId: null,
-        brandName: null,
-        categoryId: null,
-        categoryName: null,
-        wbId: null, // 维保工单
-        wbIsAllFee: null, // 维保工单是否包含全部费用
-        wbPayType: null, // 维保工单费用支付方式
+// #ifdef H5
+export default {
+  data() {
+    return {
+      type: 'M',
+      userMobile: '',
+      orderNo: '',
+      salesType: 'OUT',
+      brandId: null,
+      brandName: null,
+      categoryId: null,
+      categoryName: null,
+      wbId: null, // 维保工单
+      wbIsAllFee: null, // 维保工单是否包含全部费用
+      wbPayType: null, // 维保工单费用支付方式
 
-        keyword: '',
-				leftList: [],
-				leftCurrent: 0,
-				rightList: [],
-        loadStatus: 0,
-        isShowDialog: false,
+      keyword: '',
+		leftList: [],
+		leftCurrent: 0,
+		rightList: [],
+      loadStatus: 0,
+      isShowDialog: false,
 
-        cartList: [],
-      }
-    },
+      cartList: [],
+    }
+  },
 
-    computed: {
-      totalNum() {
-        // let val = 0;
-        // this.cartList.forEach(item => {
-        //   val = val + item.num;
-        // })
-        return this.cartList.length;
-      },
-      totalPrice() {
-        let val = 0;
-        this.cartList.forEach(item => {
-          val = val + (item.num * (item.goodsAmount * 100) / 100);
-        })
-        return val;
-      },
+  computed: {
+    totalNum() {
+      // let val = 0;
+      // this.cartList.forEach(item => {
+      //   val = val + item.num;
+      // })
+      return this.cartList.length;
     },
-
-    onLoad({type, userMobile, orderNo, salesType, brandId, brandName, categoryId, categoryName, websitId, websitName, wbId, wbIsAllFee, wbPayType}) {
-      this.type = type;
-      this.userMobile = userMobile;
-      this.orderNo = orderNo;
-      this.salesType = salesType;
-      this.brandId = brandId;
-      this.brandName = brandName;
-      this.categoryId = categoryId;
-      this.categoryName = categoryName;
-      this.websitId = websitId;
-      this.websitName = websitName;
-      this.wbId = wbId;
-      this.wbIsAllFee = wbIsAllFee;
-      this.wbPayType = wbPayType;
-
-      uni.setNavigationBarTitle({
-       title: type == 'M' ? '选择辅材' : '选择配件'
+    totalPrice() {
+      let val = 0;
+      this.cartList.forEach(item => {
+        val = val + (item.num * (item.goodsAmount * 100) / 100);
       })
-      if(type === 'M') {
-        this.getLeftList();
-      }else {
-        this.getRightList();
-      }
+      return val;
     },
+  },
 
-    methods: {
-      // 获取左侧分类
-      getLeftList() {
-      	this.$api.post('/pay/websitCategoryList', {
-          pageNum: 1,
-          pageSize: -1,
-        }).then(res => {
-      		this.leftList = res.data.records;
-      		this.leftCurrent = res.data.records.length > 0 ? res.data.records[0].categoryId : 0;
-      		this.getRightList();
-      	})
-      },
-
-      // 获取右侧产品
-      getRightList() {
-      	this.loadStatus = 1;
-        let url = '', params = {};
-        if(this.type === 'M') {
-          url = '/pay/chargeList';
-          params = {
-            categoryId: this.leftCurrent,
-            orderId: this.orderNo,
-          }
-        }else {
-          url = '/pay/websitGoodsList';
-          params = {
-            categoryName: this.categoryName,
-            brand: this.brandName,
-            orderId: this.orderNo,
-            // normType: 'M'
-          }
-        }
-
-      	this.$api.post(url, {
-          pageNum: 1,
-          pageSize: -1,
-          name: this.keyword,
-          ...params
-      	}).then(res => {
-      		this.loadStatus = 0;
-          let list = res.data.records.map(item => {
-            return this.type === 'M' ? {
-              goodsId: item.normId,
-              goodsName: item.normName,
-              goodsCode: item.normCode,
-              goodsUnit: item.unit,
-              goodsAmount: item.normAmount,
-              num: 0
-            } : {
-              goodsId: item.goodsId,
-              goodsName: item.goodsName,
-              goodsCode: item.goodsCode,
-              goodsUnit: item.goodsSalesUnit,
-              goodsAmount: item.normAmount,
-              normType: item.normType,
-              num: 0
-            }
-          });
-          for(let i = 0; i < list.length; i++) {
-            for(let j = 0; j < this.cartList.length; j++) {
-              if(list[i].goodsId == this.cartList[j].goodsId) {
-                list[i].num = this.cartList[j].num;
-              }
-            }
-          }
-      		if(list.length < 1){
-      			this.loadStatus = 2;
-      		}
-      		this.rightList = list;
-      	}).catch(() => {
-      		this.loadStatus = 2;
-      	})
-      },
+  onLoad({type, userMobile, orderNo, salesType, brandId, brandName, categoryId, categoryName, websitId, websitName, wbId, wbIsAllFee, wbPayType}) {
+    this.type = type;
+    this.userMobile = userMobile;
+    this.orderNo = orderNo;
+    // this.salesType = salesType;
+    // this.brandId = brandId;
+    // this.brandName = brandName;
+    this.categoryId = categoryId;
+    this.categoryName = categoryName;
+    this.websitId = websitId;
+    this.websitName = websitName;
+    this.wbId = wbId;
+    this.wbIsAllFee = wbIsAllFee;
+    this.wbPayType = wbPayType;
 
-      // 切换一级菜单
-      changeLeft(pid) {
-      	this.leftCurrent = pid;
-      	this.getRightList();
-      },
+    uni.setNavigationBarTitle({
+     title: type == 'M' ? '选择辅材' : '选择配件'
+    })
+    if(type === 'M') {
+      this.getLeftList();
+    }else {
+      this.getRightList();
+    }
+  },
 
-      // 搜索
-      searchData() {
-        this.getRightList();
-      },
+  methods: {
+    // 获取左侧分类
+    getLeftList() {
+    	this.$api.post('/pay/websitCategoryList', {
+        pageNum: 1,
+        pageSize: -1,
+      }).then(res => {
+    		this.leftList = res.data.records;
+    		this.leftCurrent = res.data.records.length > 0 ? res.data.records[0].categoryId : 0;
+    		this.getRightList();
+    	})
+    },
 
-      changeNum(e) {
-        let obj = this.rightList.find((item) => item.goodsId === e.name);
-        if(e.unit && e.unit != '米') {
-          e.value = Math.floor(e.value);
-          obj.num = Math.floor(obj.num);
-        }
-        // 判断对象数组中是否存在该对象
-        let index = this.cartList.findIndex((item) => item.goodsId === obj.goodsId);
-        // 如果是0,就删除
-        if(index !== -1 && e.value == 0) {
-          this.cartList.splice(index, 1);
+    // 获取右侧产品
+    getRightList() {
+    	this.loadStatus = 1;
+      let url = '', params = {};
+      if(this.type === 'M') {
+        url = '/pay/chargeList';
+        params = {
+          categoryId: this.leftCurrent,
+          orderId: this.orderNo,
         }
-        // 如果有就替换,没有就添加
-        else if (index !== -1) {
-        	this.cartList.splice(index, 1, obj);
+      }else {
+        url = '/pay/websitGoodsList';
+        params = {
+          categoryName: this.categoryName,
+          brand: this.brandName,
+          orderId: this.orderNo,
+          // normType: 'M'
         }
-        else {
-          if(e.value > 0) {
-            this.cartList.push(obj);
+      }
+
+    	this.$api.post(url, {
+        pageNum: 1,
+        pageSize: -1,
+        name: this.keyword,
+        ...params
+    	}).then(res => {
+    		this.loadStatus = 0;
+        let list = res.data.records.map(item => {
+          return this.type === 'M' ? {
+            goodsId: item.normId,
+            goodsName: item.normName,
+            goodsCode: item.normCode,
+            goodsUnit: item.unit,
+            goodsAmount: item.normAmount,
+            num: 0
+          } : {
+            goodsId: item.goodsId,
+            goodsName: item.goodsName,
+            goodsCode: item.goodsCode,
+            goodsUnit: item.goodsSalesUnit,
+            goodsAmount: item.normAmount,
+            normType: item.normType,
+            num: 0
+          }
+        });
+        for(let i = 0; i < list.length; i++) {
+          for(let j = 0; j < this.cartList.length; j++) {
+            if(list[i].goodsId == this.cartList[j].goodsId) {
+              list[i].num = this.cartList[j].num;
+            }
           }
         }
-      },
+    		if(list.length < 1){
+    			this.loadStatus = 2;
+    		}
+    		this.rightList = list;
+    	}).catch(() => {
+    		this.loadStatus = 2;
+    	})
+    },
 
-      changeCartNum(e) {
-        let obj = this.cartList.find((item) => item.goodsId === e.name);
-        if(e.unit && e.unit != '米') {
-          e.value = Math.floor(e.value);
-          obj.num = Math.floor(obj.num);
-        }
-        let index = this.cartList.findIndex((item) => item.goodsId === obj.goodsId);
-        this.cartList.splice(index, 1, obj);
+    // 切换一级菜单
+    changeLeft(pid) {
+    	this.leftCurrent = pid;
+    	this.getRightList();
+    },
 
-        this.getRightList();
-      },
+    // 搜索
+    searchData() {
+      this.getRightList();
+    },
 
-      overlimitFun(index) {
-        this.$modal({
-          content: '把该产品从购物车移除?'
-        }).then(() => {
-          this.cartList.splice(index, 1);
-          this.getRightList();
-        }).catch(() => {})
-      },
+    changeNum(e) {
+      let obj = this.rightList.find((item) => item.goodsId === e.name);
+      if(e.unit && e.unit != '米') {
+        e.value = Math.floor(e.value);
+        obj.num = Math.floor(obj.num);
+      }
+      // 判断对象数组中是否存在该对象
+      let index = this.cartList.findIndex((item) => item.goodsId === obj.goodsId);
+      // 如果是0,就删除
+      if(index !== -1 && e.value == 0) {
+        this.cartList.splice(index, 1);
+      }
+      // 如果有就替换,没有就添加
+      else if (index !== -1) {
+      	this.cartList.splice(index, 1, obj);
+      }
+      else {
+        if(e.value > 0) {
+          this.cartList.push(obj);
+        }
+      }
+    },
 
-      clearCart() {
-        this.$modal({
-          content: '确定清空购物车?'
-        }).then(() => {
-          this.cartList = [];
-          this.getRightList();
-        }).catch(() => {})
-      },
+    changeCartNum(e) {
+      let obj = this.cartList.find((item) => item.goodsId === e.name);
+      if(e.unit && e.unit != '米') {
+        e.value = Math.floor(e.value);
+        obj.num = Math.floor(obj.num);
+      }
+      let index = this.cartList.findIndex((item) => item.goodsId === obj.goodsId);
+      this.cartList.splice(index, 1, obj);
 
-      submitData() {
-        if(this.cartList.length < 1) return this.$toast('请选择');
-        this.$setStorage('materialSaleData', {
-          type: this.type,
-          brandId: this.brandId,
-          brandName: this.brandName,
-          categoryId: this.type == 'P' ? this.categoryId : '',
-          categoryName: this.type == 'P' ? this.categoryName : '',
-          websitId: this.websitId,
-          websitName: this.websitName,
-          salesType: this.salesType,
-          userMobile: this.userMobile,
-          orderNo: this.orderNo,
-          wbId: this.wbId,
-          wbIsAllFee: this.wbIsAllFee,
-          wbPayType: this.wbPayType,
-          goodsList: this.cartList
-        });
-        this.$navToPage({
-          url: `/packageMaterial/pages/sale/order`
-        })
-      },
+      this.getRightList();
+    },
 
+    overlimitFun(index) {
+      this.$modal({
+        content: '把该产品从购物车移除?'
+      }).then(() => {
+        this.cartList.splice(index, 1);
+        this.getRightList();
+      }).catch(() => {})
     },
-  }
 
-  // #endif
-  // #ifndef H5
-  export default {
-    data() {
-      return {
-        pam: {},
-      }
+    clearCart() {
+      this.$modal({
+        content: '确定清空购物车?'
+      }).then(() => {
+        this.cartList = [];
+        this.getRightList();
+      }).catch(() => {})
     },
-    onLoad(pam) {
-      this.pam = pam;
+
+    submitData() {
+      if(this.cartList.length < 1) return this.$toast('请选择');
+      this.$setStorage('materialSaleData', {
+        type: this.type,
+        salesType: this.salesType,
+        brandId: this.brandId,
+        brandName: this.brandName,
+        categoryId: this.type == 'P' ? this.categoryId : '',
+        categoryName: this.type == 'P' ? this.categoryName : '',
+        websitId: this.websitId,
+        websitName: this.websitName,
+        userMobile: this.userMobile,
+        orderNo: this.orderNo,
+        wbId: this.wbId,
+        wbIsAllFee: this.wbIsAllFee,
+        wbPayType: this.wbPayType,
+        goodsList: this.cartList
+      });
+      this.$navToPage({
+        url: `/packageMaterial/pages/sale/order`
+      })
+    },
+
+  },
+}
+
+// #endif
+// #ifndef H5
+export default {
+  data() {
+    return {
+      pam: {},
     }
+  },
+  onLoad(pam) {
+    this.pam = pam;
   }
-  // #endif
+}
+// #endif
 </script>
 
 <style lang="scss" scoped>
@@ -378,17 +393,17 @@
   ::v-deep .u-search {
     height: 60rpx;
     input {
-      background: #F7F8FF !important;
+      background: #f7f8ff !important;
     }
     .u-search__content {
-      background: #F7F8FF !important;
+      background: #f7f8ff !important;
       height: 60rpx;
     }
   }
 }
 .empty-container {
   height: 100%;
-  background: #FFFFFF;
+  background: #ffffff;
   display: flex;
   flex-direction: column;
   align-items: center;
@@ -425,15 +440,15 @@
       align-items: center;
       padding: 0 20rpx;
       &.current {
-        color: #FFFFFF;
+        color: #ffffff;
         background: $theme-color;
       }
     }
   }
   .right-list {
     flex: 1;
-    background: #FFFFFF;
-    background: #FFFFFF;
+    background: #ffffff;
+    background: #ffffff;
     height: 100%;
     box-sizing: border-box;
     .item {
@@ -526,7 +541,7 @@
   left: 0;
   width: 100%;
   height: 100%;
-  background: rgba($color: #000000, $alpha: .6);
+  background: rgba($color: #000000, $alpha: 0.6);
 }
 .dialog-container {
   width: 100%;