Просмотр исходного кода

Merge remote-tracking branch 'origin/testing' into testing

zhaohuanhuan 7 месяцев назад
Родитель
Сommit
b85798c9b2
1 измененных файлов с 54 добавлено и 41 удалено
  1. 54 41
      src/views/returned/register/index.vue

+ 54 - 41
src/views/returned/register/index.vue

@@ -387,6 +387,7 @@
       :lazy-render="true"
       :show-confirm-button="checkUploadImages()"
       @confirm="addDetails"
+      @cancel="cancelReturnedDetailDialog"
     >
       <div style="max-height: 70vh; overflow-y: auto">
         <van-field
@@ -642,7 +643,7 @@
           capture="user"
           accept="image/*"
           hidden
-          @change ="outerCartonInput"
+          @change="outerCartonInput"
         />
 
         <input
@@ -651,7 +652,7 @@
           capture="user"
           accept="image/*"
           hidden
-          @change ="innerContentsInput"
+          @change="innerContentsInput"
         />
       </div>
     </van-dialog>
@@ -681,7 +682,7 @@ import {
   showLoadingToast,
   closeToast,
   showConfirmDialog,
-  showImagePreview,
+  showImagePreview
 } from 'vant'
 import { getHeader, goBack, scanError, scanSuccess } from '@/utils/android'
 import {
@@ -699,7 +700,7 @@ import {
   searchBarcode,
   searchOwnerBarcode,
   shops,
-  validateDate,
+  validateDate
 } from '@/api/returned/index.ts'
 import { carrierOptions, getOwner, getWarehouse } from '@/api/basic/index.ts'
 import { useStore } from '@/store/modules/user'
@@ -897,7 +898,7 @@ const params = ref({
   buyerPhone: null,
   originalNo: null,
   remark: null,
-  details: [],
+  details: []
 })
 
 // 商品信息
@@ -937,7 +938,7 @@ const selectDetail = ref({
   operatorName: null,
   operatorTime: null,
   skuImage: null,
-  orginSkuImage: null,
+  orginSkuImage: null
 })
 
 function initDetail() {
@@ -977,7 +978,7 @@ function initDetail() {
     operatorName: null,
     operatorTime: null,
     skuImage: null,
-    orginSkuImage: null,
+    orginSkuImage: null
   }
 }
 
@@ -1073,7 +1074,7 @@ function matchReturned(express_no) {
       if (['已入仓', '已拆包'].includes(headStatus)) {
         showNotify({
           type: 'primary',
-          message: `当前退回单号${returnNo}--${headStatus}`,
+          message: `当前退回单号${returnNo}--${headStatus}`
         })
         init(false)
         params.value.id = id
@@ -1088,7 +1089,7 @@ function matchReturned(express_no) {
       } else {
         showNotify({
           type: 'danger',
-          message: '当前退回单号已进行过登记 如需修改请前往PC端进行',
+          message: '当前退回单号已进行过登记 如需修改请前往PC端进行'
         })
         scanSuccess()
       }
@@ -1114,7 +1115,7 @@ function matchOrder(expressNo) {
         recipientName,
         phone,
         logisticName,
-        details,
+        details
       } = data
       showNotify({ type: 'success', message: '匹配到原单信息' })
       params.value.upstreamNo = upstreamNo
@@ -1142,7 +1143,7 @@ function matchOrder(expressNo) {
           expirationDate,
           batchNumber,
           quality,
-          attributeBin,
+          attributeBin
         } = item
         let qualityStatus
         if (quality) {
@@ -1167,7 +1168,7 @@ function matchOrder(expressNo) {
           batchNumber: batchNumber,
           warehouse: attributeBin,
           qualityStatus: qualityStatus,
-          isOriginal: true,
+          isOriginal: true
         })
         params.value.details = list
         matchCarrier(expressNo)
@@ -1184,7 +1185,7 @@ function matchCarrier(expressNo) {
     if (!data || data.length === 0) {
       showNotify({
         type: 'primary',
-        message: '请手动选择承运商',
+        message: '请手动选择承运商'
       })
     } else {
       params.value.logisticsName = data
@@ -1212,7 +1213,7 @@ function matchAsn(expressNo) {
       shopName,
       recipientName,
       logisticName,
-      upstreamNo,
+      upstreamNo
     } = data
     params.value.returnNo = expressNo
     params.value.upstreamNo = upstreamNo
@@ -1292,7 +1293,7 @@ function init(showInputPage = true) {
     buyerPhone: null,
     originalNo: null,
     remark: null,
-    details: [],
+    details: []
   }
   storeOptions.value = []
   expressNo.value = null
@@ -1339,7 +1340,7 @@ async function queryBarcode() {
   showLoadingToast({
     duration: 0,
     forbidClick: true,
-    message: '查询商品信息中.....',
+    message: '查询商品信息中.....'
   })
   const barcode = scancode.value
   const { ownerCode, details } = params.value
@@ -1366,7 +1367,7 @@ async function queryOwnerBarcode(ownerCode, barcode) {
   try {
     const results = await searchOwnerBarcode({ ownerCode, barcode })
     const {
-      data: { basSku },
+      data: { basSku }
     } = results
     if (!basSku) {
       return false
@@ -1374,6 +1375,7 @@ async function queryOwnerBarcode(ownerCode, barcode) {
     addDetailByBasSku(basSku)
     return true
   } catch (err) {
+    closeToast()
     console.log(err.message)
   }
   return false
@@ -1396,6 +1398,7 @@ async function queryBarcodeBy(barcode) {
     scanSuccess()
     return null
   } catch (err) {
+    closeToast()
     scanError()
     console.log(err.message)
   }
@@ -1481,7 +1484,7 @@ const manufactureTimeConfirm = async (result) => {
     ownerCode,
     sku,
     manufactureTime,
-    'manufactureTime',
+    'manufactureTime'
   )
   if (!check_validate_date) {
     console.log('检验出现异常')
@@ -1510,7 +1513,7 @@ const validityTimeConfirm = async (result) => {
     ownerCode,
     sku,
     validityTime,
-    'validityTime',
+    'validityTime'
   )
   if (!check_validate_date) {
     return
@@ -1524,6 +1527,11 @@ function getTagColor(qualityStatus) {
   return getTagColorBy(qualityStatus)
 }
 
+const cancelReturnedDetailDialog = async () => {
+  returnedDetailDialog.value = false
+  initDetail()
+}
+
 const addDetails = async () => {
   const isCheck = checkUploadImages()
   if (!isCheck) {
@@ -1543,7 +1551,7 @@ const addDetails = async () => {
     validityTime: detail_validity_time,
     manufactureTime: detail_manufacture_time,
     qualityStatus: detail_quality_status,
-    number: detailNumber,
+    number: detailNumber
   } = selectDetail.value
   if (['次品', '待修复'].includes(detail_quality_status)) {
     params.value.details.push(detail)
@@ -1564,7 +1572,7 @@ const addDetails = async () => {
   if (searchIndex > -1) {
     showConfirmDialog({
       title: '系统提示',
-      message: '查询到有对应的商品详情是否进行合并',
+      message: '查询到有对应的商品详情是否进行合并'
     })
       .then(() => {
         const { number } = params.value.details[searchIndex]
@@ -1591,7 +1599,7 @@ function removeDetails(index) {
   }
   showConfirmDialog({
     title: '系统提示',
-    message: '是否删除当前登记信息',
+    message: '是否删除当前登记信息'
   })
     .then(() => {
       const { id } = params.value.details[index]
@@ -1667,17 +1675,17 @@ async function checkValidateDate(ownerCode, sku, newDate, fieldName) {
       newDate: newDate,
       fieldName: fieldName,
       ownerCode: ownerCode,
-      sku: sku,
+      sku: sku
     })
     showNotify({
       type: 'success',
-      message: `${type} 状态校验成功 `,
+      message: `${type} 状态校验成功 `
     })
     return true
   } catch (error) {
     showNotify({
       type: 'danger',
-      message: `校验${type}出现异常`,
+      message: `校验${type}出现异常`
     })
     return false
   }
@@ -1719,7 +1727,7 @@ function pushImageItem(event, type) {
     src: URL.createObjectURL(file),
     file: file,
     fileName: filename,
-    type,
+    type
   }
 
   if (type === '外箱图') {
@@ -1802,25 +1810,25 @@ function submit() {
   if (!ownerCode || ownerCode.length === 0) {
     showNotify({
       type: 'warning',
-      message: '没有对应的退件详情!请录入对应的退件详情',
+      message: '没有对应的退件详情!请录入对应的退件详情'
     })
     return
   } else if (!logisticsName || logisticsName.length === 0) {
     showNotify({
       type: 'warning',
-      message: '请录入承运商',
+      message: '请录入承运商'
     })
     return
   } else if (!returnNo || ownerCode.length === 0) {
     showNotify({
       type: 'warning',
-      message: '请录入退件单号',
+      message: '请录入退件单号'
     })
     return
   } else if (!warehouseCode || warehouseCode.length === 0) {
     showNotify({
       type: 'warning',
-      message: '请选择登记仓库',
+      message: '请选择登记仓库'
     })
     return
   }
@@ -1846,12 +1854,12 @@ function submit() {
   }
 
   handleDetails(params.value.details)
-  formData.append('body', JSON.stringify(params.value))
+  formData.append('body', JSON.stringify(JSON.parse(JSON.stringify(params.value))))
   console.log(formData)
   showLoadingToast({
     duration: 0,
     forbidClick: true,
-    message: '提交登记中.....',
+    message: '提交登记中.....'
   })
 
   register(formData)
@@ -1871,12 +1879,12 @@ function submit() {
           showConfirmDialog({
             title: '提交成功',
             message: messages.join('\r\n'),
-            theme: 'round-button',
+            theme: 'round-button'
           })
         } else {
           showNotify({
             type: 'success',
-            message: '成功提交',
+            message: '成功提交'
           })
         }
         init()
@@ -1893,7 +1901,7 @@ function checkDetailNumber() {
   if (!details || details.length === 0) {
     showNotify({
       type: 'warning',
-      message: '登记详情不能为空',
+      message: '登记详情不能为空'
     })
     return true
   }
@@ -1904,7 +1912,7 @@ function checkDetailNumber() {
   if (check) {
     showNotify({
       type: 'warning',
-      message: '登记数量不能为 0 和 空 ',
+      message: '登记数量不能为 0 和 空 '
     })
   }
   return check
@@ -1933,7 +1941,7 @@ const onPhotosPreviewChange = (index) => {
 const handlePhotosDelete = () => {
   showConfirmDialog({
     title: '提示',
-    message: '确定要删除这张图片吗?',
+    message: '确定要删除这张图片吗?'
   })
     .then(() => {
       selectDetail.value.productPhotos.splice(startPhotosPosition.value, 1)
@@ -1965,7 +1973,7 @@ const onBoxPreviewChange = (index) => {
 const handleBoxDelete = () => {
   showConfirmDialog({
     title: '提示',
-    message: '确定要删除这张图片吗?',
+    message: '确定要删除这张图片吗?'
   })
     .then(() => {
       selectDetail.value.boxPhotos.splice(startBoxPosition.value, 1)
@@ -2014,13 +2022,18 @@ function checkUploadImages() {
   if (!status.includes(qualityStatus)) {
     return true
   }
+
+  if (!qualityStatus) {
+    return true
+  }
+
   const boxPhotoIsNull = !boxPhotos || boxPhotos.length === 0
   const productPhotoIsNull = !productPhotos || productPhotos.length === 0
 
   if (boxPhotoIsNull) {
     showNotify({
       type: 'warning',
-      message: '请传入对应的外箱图',
+      message: '请传入对应的外箱图'
     })
     return false
   }
@@ -2028,7 +2041,7 @@ function checkUploadImages() {
   if (productPhotoIsNull) {
     showNotify({
       type: 'warning',
-      message: '请传入对应的内物图',
+      message: '请传入对应的内物图'
     })
     return false
   }
@@ -2072,7 +2085,7 @@ function previewImages(filenames, index, type) {
   }
   showImagePreview({
     images: images,
-    startPosition: index,
+    startPosition: index
   })
 }
 </script>