refundSuccess.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <template>
  2. <appResult :title="title">
  3. <button class="admin-button-com big blue" style="width:80%;" @click="goBack">返回</button>
  4. <view v-if="!$util.isEmpty(itemList)" style="margin-top:20upx;">
  5. <block v-for="(item, index) in itemList" :key="index">
  6. <view style="text-align:center;margin-bottom:10upx;" v-if="item.xhUnitType == 0">
  7. <text style="font-size:32upx;">
  8. {{item.name}} 已退{{item.xhNum}}{{item.xhUnitName}}
  9. <text v-if="Number(item.xhWasteNum)>0" style="margin-left:12upx;color:green;">
  10. 已报损{{item.xhWasteNum}}{{item.xhUnitName}}
  11. </text>
  12. </text>
  13. <button class="admin-button-com middle" style="margin:10upx auto 0 auto;" @click="beginWastage(item)">报损</button>
  14. </view>
  15. </block>
  16. </view>
  17. <modal-module :show="wastageShow" @click="confirmWastage" :maskClosable="true" title="数量" padding="30rpx 30rpx" >
  18. <template v-slot:content>
  19. <div class="app-modal-input-wrap">
  20. <div class="inp-list-line">
  21. <div class="line-input">
  22. <input type="number" ref="input" style="width:61.8%;text-align:center;" v-model="wastageNum" :adjust-position="false" class="inp-input" @focus="wastageNum=''" />
  23. </div>
  24. </div>
  25. </div>
  26. </template>
  27. </modal-module>
  28. </appResult>
  29. </template>
  30. <script>
  31. import appResult from "@/components/app-result";
  32. import { refundDetail,refundWaste } from "@/api/refund";
  33. import ModalModule from "@/components/plugin/modal"
  34. export default {
  35. name: "commonSuccess",
  36. components: {
  37. appResult,
  38. ModalModule
  39. },
  40. data() {
  41. return {
  42. title:'操作成功',
  43. info:[],
  44. itemList:[],
  45. wastageItemId:0,
  46. wastageShow:false,
  47. wastageNum:0,
  48. refundItemId:0
  49. };
  50. },
  51. methods: {
  52. beginWastage(item){
  53. this.wastageShow = true
  54. this.wastageNum = item.xhNum
  55. this.wastageItemId = item.productId
  56. this.refundItemId = item.id
  57. },
  58. init(){
  59. let that = this
  60. refundDetail({ id: this.option.id }).then(res=>{
  61. that.info = res.data.info ? res.data.info : []
  62. that.itemList = res.data.itemList ? res.data.itemList : []
  63. })
  64. },
  65. goBack() {
  66. uni.navigateBack({})
  67. },
  68. hideWaste(){
  69. this.wastageShow = false
  70. this.wastageNum = 0
  71. this.wastageItemId = 0
  72. },
  73. confirmWastage(val){
  74. if (val.index === 0) {
  75. this.hideWaste()
  76. return false
  77. }
  78. let that = this
  79. refundWaste({wasteProductId:this.wastageItemId,wasteNum:this.wastageNum,remark:'退货时报损',refundItemId:this.refundItemId}).then(res=>{
  80. if(res.code == 1){
  81. that.hideWaste()
  82. that.init()
  83. }
  84. })
  85. }
  86. },
  87. };
  88. </script>
  89. <style lang="scss" scoped>
  90. .admin-button-com {
  91. margin-bottom: 20upx;
  92. width: 100%;
  93. }
  94. </style>