linwenxin 7 bulan lalu
induk
melakukan
bb4d84c59e

+ 6 - 8
src/packageAttachment/pages/applicationParts/applicationPartsForm.vue

@@ -181,11 +181,9 @@
           </view>
         </view>
       </zj-page-fill>
-      <bt-container>
-        <view class="btcon pv30 ph10">
-          <view class="confirm-btn" @tap.stop="save">提交申请</view>
-        </view>
-      </bt-container>
+      <view class="bottom-container">
+        <u-button type="primary" text="提交申请" @click="save"></u-button>
+      </view>
     </zj-page-container>
   </view>
 </template>
@@ -216,9 +214,9 @@ export default {
       receiveUnit: this.userInfo.username,
       workerId: this.userInfo.number,
       workerName: this.userInfo.username,
-      belongCompany: this.userInfo.belong_company,
-      websitName: this.userInfo.websit_worker.websit_name,
-      websitNumber: this.userInfo.websit_worker.websit_number
+      belongCompany: this?.userInfo?.belong_company,
+      websitName: this?.userInfo?.websit_worker?.websit_name,
+      websitNumber: this?.userInfo?.websit_worker?.websit_number
     }
     console.log(this.userInfo)
     uni.$on('getAccessoriesItem', data => {

+ 76 - 100
src/packageAttachment/pages/applicationParts/index.vue

@@ -1,48 +1,38 @@
 <template>
   <view style="width: 100%; height: 100vh">
     <zj-page-container>
-      <view>
-        <!-- 左上角返回按钮 -->
-        <image
-          @tap.stop="navBack"
-          class="map-back"
-          src="/static/images/map_back.png"
-          mode=""
-          :style="{ top: StatusBar + 'px' }"
-        ></image>
-        <!-- 申请记录按钮 -->
-        <view class="record-application" @tap.stop="toNavigate" :style="{ top: StatusBar + 'px' }">
-          <text class="record-application-text">申请记录</text>
-        </view>
-      </view>
       <zj-page-fill
         @scrolltolower="loadMore"
         :scrollAttribute="{
           'refresher-enabled': false
         }"
       >
-        <view class="list_view_lay">
-          <view class="box" v-for="item in websitList" :key="item.websitId">
-            <view class="mb20 flex_abs mt20">
-              <text class="fw600 f32_302">{{ item.websitName }}</text>
-              <text class="f24_999">距离{{ item.distance }}km</text>
-            </view>
-            <view class="flex_abs">
-              <text class="f28_666" style="width: 520rpx">地址:{{ item.address }}</text>
-              <tag
-                style="
-                  width: 150rpx;
-                  height: 50rpx;
-                  background-image: linear-gradient(to bottom right, #7fdaff, #6da7ff);
-                  border-radius: 30rpx;
-                "
-              >
-                <text @tap.stop="toApplicationPartsForm(item)" class="f24_FFF">申请</text>
-              </tag>
-            </view>
+        <view class="box_list" v-for="item in websitList" :key="item.websitId">
+          <view>
+            <text>{{ item.name }}</text>
+            <text>距离{{ item.distance }}km</text>
+          </view>
+          <view class="flex_abs">
+            <text style="width: 520rpx; margin-right: 20rpx">地址:{{ item.address }}</text>
+            <tag
+              style="
+                width: 150rpx;
+                height: 50rpx;
+                background-image: linear-gradient(to bottom right, #7fdaff, #6da7ff);
+                border-radius: 30rpx;
+              "
+            >
+              <text @tap.stop="toApplicationPartsForm(item)">申请</text>
+            </tag>
           </view>
         </view>
       </zj-page-fill>
+      <view
+        style="width: 100%; height: auto; padding: 20rpx 20rpx 40rpx 20rpx; box-sizing: border-box; background: #fff"
+      >
+        <!-- 申请记录按钮 -->
+        <view class="record-application" @tap.stop="toNavigate" :style="{ top: StatusBar + 'px' }"> 申请记录 </view>
+      </view>
     </zj-page-container>
   </view>
 </template>
@@ -73,31 +63,22 @@ export default {
       ],
       websitList: [],
       page: 1,
-      pageSize: 3,
-      websit_number: ''
+      pageSize: 3
     }
   },
-  async onShow() {
-    const getWebsit_number = uni.getStorageSync('userInfo')
-    this.websit_number = getWebsit_number.websit_number
-    await this.getCurrentWebsit()
+  async onLoad() {
     await this.getWebsitList()
   },
   methods: {
-    navBack() {
-      uni.navigateBack({
-        delta: 1
-      })
-    },
     toNavigate() {
       this.$navToPage({
         url: `/packageAttachment/pages/orderOfSales/index`
       })
     },
     toApplicationPartsForm(item) {
-      var { websitId, websitName, partsWebsitId } = item
+      var { websitId, name, partsWebsitId } = item
       this.$navToPage({
-        url: `/packageAttachment/pages/applicationParts/applicationPartsForm?websitId=${websitId}&websitName=${websitName}&partsWebsitId=${partsWebsitId}`
+        url: `/packageAttachment/pages/applicationParts/applicationPartsForm?websitId=${websitId}&websitName=${name}&partsWebsitId=${partsWebsitId}`
       })
     },
     loadMore() {
@@ -105,67 +86,60 @@ export default {
       this.getWebsitList()
     },
     getWebsitList() {
-      let params = {
-        latitude: this.latitude,
-        longitude: this.longitude,
-        pageNo: this.page,
-        pageSize: this.pageSize,
-        websitNumber: this.websit_number
-      }
-      api.post('/app/buy/websit/list', params).then(res => {
-        this.websitList = this.websitList.concat(res.data.records).filter(item => item.partsWebsitId)
+      this.getCurrentWebsit(() => {
+        let params = {
+          latitude: this.latitude,
+          longitude: this.longitude,
+          pageNo: this.page,
+          pageSize: this.pageSize
+        }
+        api.post('/app/buy/websit/list', params).then(res => {
+          this.websitList = this.websitList.concat(res.data.records).filter(item => item.partsWebsitId)
+        })
       })
     },
-    async getCurrentWebsit() {
-      try {
-        const addressInfo = await new Promise((resolve, reject) => {
-          wx.getLocation({
-            type: 'gcj02',
-            isHighAccuracy: true,
-            geocode: true,
-            success: res => {
-              resolve({
-                lat: res.latitude,
-                lng: res.longitude,
-                address: res.address
-              })
-            },
-            fail: err => {
-              reject(err)
-            }
+    async getCurrentWebsit(cb) {
+      if (this.latitude && this.longitude) {
+        cb?.()
+      } else {
+        try {
+          const addressInfo = await new Promise((resolve, reject) => {
+            wx.getLocation({
+              type: 'gcj02',
+              isHighAccuracy: true,
+              geocode: true,
+              success: res => {
+                resolve({
+                  lat: res.latitude,
+                  lng: res.longitude,
+                  address: res.address
+                })
+              },
+              fail: err => {
+                reject(err)
+              }
+            })
           })
-        })
-        let { lat, lng } = addressInfo
-        this.latitude = lat
-        this.longitude = lng
-      } catch (error) {}
+          let { lat, lng } = addressInfo
+          this.latitude = lat
+          this.longitude = lng
+          cb?.()
+        } catch (error) {
+          console.log(error)
+        }
+      }
     }
   }
 }
 </script>
 
 <style scoped lang="scss">
-.map-back {
-  position: absolute;
-  left: 30rpx;
-  width: 60rpx;
-  height: 60rpx;
-  border-radius: 30rpx;
-  overflow: hidden;
-}
-
 .record-application {
-  position: absolute;
-  right: 30rpx;
-  width: auto;
+  width: 100%;
   height: 60rpx;
   border-radius: 30rpx;
   box-sizing: border-box;
-  padding: 0 20rpx;
   background: #6da7ff;
-}
-
-.record-application-text {
   font-size: 28rpx;
   font-weight: 500;
   text-align: center;
@@ -173,14 +147,16 @@ export default {
   line-height: 60rpx;
 }
 
-.item {
-  background-color: #ffffff;
-  overflow: hidden;
-  border-bottom: 2rpx solid #f7f7f7;
-  padding-bottom: 20rpx;
+.box_list {
+  width: 100%;
+  height: auto;
+  padding: 20rpx;
+  background: #ffffff;
+  border-bottom: 1rpx solid #bebebe;
 }
-
 .flex_abs {
-  flex-direction: row;
+  width: 100%;
+  height: auto;
+  display: flex;
 }
 </style>

+ 4 - 6
src/packageAttachment/pages/sparePartsInventory/choosingAccessories.vue

@@ -30,7 +30,7 @@
                   @tap.stop="accessoriesIndex = index"
                 >
                   <view class="accessories_type_text">
-                    {{ item.value }}
+                    {{ item }}
                   </view>
                 </view>
               </zj-page-fill>
@@ -62,11 +62,9 @@
           </zj-page-fill>
         </zj-page-container>
       </zj-page-fill>
-      <bt-container>
-        <view class="btcon pv30 ph10">
-          <view class="confirm-btn" @tap.stop="save">保存</view>
-        </view>
-      </bt-container>
+      <view class="bottom-container">
+        <u-button type="primary" text="保存" @click="save"></u-button>
+      </view>
     </zj-page-container>
   </view>
 </template>

+ 4 - 4
src/packageAttachment/pages/sparePartsInventory/choosingAccessoriesItem.vue

@@ -3,15 +3,15 @@
     <view class="accessories_item minwidth" @tap.stop="$emit('selectItem', item)">
       <view class="accessories_item_lay">
         <view class="accessories_item_title">
-          {{ item.partsName }}
+          {{ item.goodsName }}
         </view>
         <view class="accessories_item_number">
-          {{ item.partsNumber }}
+          {{ item.goodsId }}
         </view>
       </view>
       <view class="accessories_item_lay">
-        <view class="accessories_item_inventory"> 库存{{ item.newQty }} </view>
-        <view class="accessories_item_unit"> 单位:{{ item.unitName }} </view>
+        <view class="accessories_item_inventory"> 库存{{ [item.oldQty, item.qty][type] }} </view>
+        <view class="accessories_item_unit"> 单位:{{ item.goodsStockUnit }} </view>
       </view>
       <view class="accessories_item_lay">
         <view class="accessories_item_amount">