shish 3 лет назад
Родитель
Сommit
26f7e69596
2 измененных файлов с 52 добавлено и 7 удалено
  1. 4 0
      ghsApp/src/api/refund/index.js
  2. 48 7
      ghsApp/src/pagesOrder/refundSuccess.vue

+ 4 - 0
ghsApp/src/api/refund/index.js

@@ -1,5 +1,9 @@
 import https from '@/plugins/luch-request_0.0.7/request'
 
+export const refundWaste = data => {
+	return https.post('/refund/refund-waste', data)
+}
+
 //退款详情
 export const refundDetail = data => {
 	return https.get('/refund/detail', data)

+ 48 - 7
ghsApp/src/pagesOrder/refundSuccess.vue

@@ -3,30 +3,55 @@
     <button class="admin-button-com big blue" style="width:80%;" @click="goBack">返回</button>
     <view v-if="!$util.isEmpty(itemList)" style="margin-top:20upx;">
       <block v-for="(item, index) in itemList" :key="index">
-        <view style="text-align:center;margin-bottom:10upx;">
+        <view style="text-align:center;margin-bottom:10upx;" v-if="item.xhUnitType == 0">
           <text style="font-size:30upx;">{{item.name}} 已退{{item.xhNum}}{{item.xhUnitName}}</text>
-          <button class="admin-button-com middle" style="margin:10upx auto 0 auto;" @click="wastage(item)">报损</button>
+          <button class="admin-button-com middle" style="margin:10upx auto 0 auto;" @click="beginWastage(item)">报损</button>
         </view>
       </block>
     </view>
+
+		<modal-module :show="wastageLabelShow" @click="confirmWastage" :maskClosable="true" title="数量" padding="30rpx 30rpx" >
+		<template v-slot:content>
+			<div class="app-modal-input-wrap">
+			<div class="inp-list-line">
+				<div class="line-input">
+				<input type="number" ref="input" style="width:61.8%;text-align:center;" @blur="blur" v-model="wastageNum" :adjust-position="false" class="inp-input" />
+				</div>
+			</div>
+			</div>
+		</template>
+		</modal-module>
+
   </appResult>
 </template>
 <script>
 import appResult from "@/components/app-result";
-import { refundDetail } from "@/api/refund";
+import { refundDetail,refundWaste } from "@/api/refund";
+import ModalModule from "@/components/plugin/modal"
 export default {
   name: "commonSuccess",
   components: {
-    appResult
+    appResult,
+    ModalModule
   },
 	data() {
 		return {
 			title:'操作成功',
       info:[],
-      itemList:[]
+      itemList:[],
+			wastageItemId:0,
+      wastagePtItemId:0,
+			wastageLabelShow:false,
+			wastageNum:0
 		};
 	},
 	methods: {
+    beginWastage(item){
+      this.wastageLabelShow = true
+      this.wastageNum = item.xhNum
+      this.wastageItemId = item.productId
+      this.wastagePtItemId = item.itemId
+    },
     init(){
       let that = this
 			refundDetail({ id: this.option.id }).then(res=>{
@@ -37,8 +62,24 @@ export default {
     goBack() {
         uni.navigateBack({})
     },
-    wastage(){
-
+    hideWaste(){
+      this.wastageLabelShow = false
+      this.wastageNum = 0
+      this.wastageItemId = 0
+      this.wastagePtItemId = 0
+    },
+    confirmWastage(val){
+      if (val.index === 0) {
+        this.cancelWaste()
+        return false
+			}
+      let that = this
+      let product = [{"productId":this.wastageItemId,"bigNum":this.wastageNum,"smallNum":0,"classId":0,"itemId":this.wastagePtItemId,"ratio":0}]
+      refundWaste({product:JSON.stringify(product),remark:'退货时报损'}).then(res=>{
+        if(res.code == 1){
+          that.hideWaste()
+        }
+      })
     }
   },
 };