refundSuccess.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  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;">
  7. <text style="font-size:32upx;" @click="pageTo({url:'/admin/item/detail?id='+item.productId})">
  8. {{item.name}} <text style="color:#3385FF;margin-left:8upx;">已退{{item.xhNum}}{{item.xhUnitName}}</text>
  9. </text>
  10. <view style="margin-top:10upx;" v-if="Number(item.xhWasteNum)>0">
  11. <text style="margin-left:12upx;color:red;font-size:30upx;font-weight:bold;">
  12. 已报损{{item.xhWasteNum}}{{item.xhUnitName}}
  13. </text>
  14. </view>
  15. <view style="margin-top:10upx;" v-if="Number(item.xhReduceNum)>0">
  16. <text style="margin-left:12upx;color:red;font-size:30upx;font-weight:bold;">
  17. 已减库存{{item.xhReduceNum}}{{item.xhUnitName}}
  18. </text>
  19. </view>
  20. <view style="margin-top:10upx;color:#ad760d;font-size:30upx;" v-if="item.refundOptionId!=0">{{ item.refundOptionName }}</view>
  21. <view style="width:100%;margin-top:16upx;">
  22. <button class="admin-button-com middle" style="width:160upx;" @click="selOption(item)">售后原因</button>
  23. <button class="admin-button-com middle" style="margin-left:10upx;width:140upx;" @click="beginReduce(item)">减库存</button>
  24. <button class="admin-button-com middle" style="width:150upx;margin-left:10upx;" @click="beginWastage(item)" v-if="item.xhUnitType == 0">报损</button>
  25. <button class="admin-button-com middle" style="width:150upx;margin-left:10upx;" @click="pageTo({url:'/admin/item/detail?id='+item.productId})" v-else>去损报</button>
  26. </view>
  27. </view>
  28. </block>
  29. </view>
  30. <modal-module :show="wastageShow" @click="confirmWastage" :maskClosable="true" title="减少数量" padding="30rpx 30rpx" >
  31. <template v-slot:content>
  32. <div class="app-modal-input-wrap">
  33. <div class="inp-list-line">
  34. <div class="line-input">
  35. <input type="number" ref="input" style="width:61.8%;text-align:center;" v-model="wastageNum" :adjust-position="false" class="inp-input" @focus="wastageNum=''" />
  36. </div>
  37. </div>
  38. </div>
  39. </template>
  40. </modal-module>
  41. <modal-module :show="reduceShow" @click="confirmReduce" :maskClosable="true" title="报损数量" padding="30rpx 30rpx" >
  42. <template v-slot:content>
  43. <div class="app-modal-input-wrap">
  44. <div class="inp-list-line">
  45. <div class="line-input">
  46. <input type="number" ref="input" style="width:61.8%;text-align:center;" v-model="reduceNum" :adjust-position="false" class="inp-input" @focus="reduceNum=''" />
  47. </div>
  48. </div>
  49. </div>
  50. </template>
  51. </modal-module>
  52. <uni-popup ref="optionRef" background-color="#fff" type="center" :animation="false" class="class-popup-style">
  53. <view style="max-height:90vh;overflow: scroll;">
  54. <view style="margin-left:30upx;margin-top:19upx;font-size:27upx;font-weight:bold;">请选择:</view>
  55. <view style="display:flex;padding:20upx;height:auto;justify-content: flex-start;align-items:center;flex-wrap:wrap;max-height:100vh;overflow:auto;">
  56. <view v-for="(item, index) in refundOption" :key="index" style="margin-bottom:20upx;margin-left:3upx;">
  57. <button
  58. class="admin-button-com staff-btn"
  59. @click.stop="getOption(item)"
  60. :class="{'selected': currentInfo.refundOptionId === item.id}"
  61. >
  62. {{ item.name }}
  63. </button>
  64. </view>
  65. </view>
  66. <view style="text-align:center;padding:10upx 0 10upx 0;">
  67. <button class="admin-button-com big blue" style="width:210upx;" @click="cancelOption()">取消选择</button>
  68. </view>
  69. </view>
  70. </uni-popup>
  71. </appResult>
  72. </template>
  73. <script>
  74. import appResult from "@/components/app-result";
  75. import { refundDetail,refundWaste,changeRefundOption,refundReduce } from "@/api/refund";
  76. import ModalModule from "@/components/plugin/modal"
  77. export default {
  78. name: "commonSuccess",
  79. components: {
  80. appResult,
  81. ModalModule
  82. },
  83. data() {
  84. return {
  85. title:'操作成功',
  86. info:[],
  87. itemList:[],
  88. wastageShow:false,
  89. wastageNum:0,
  90. refundItemId:0,
  91. refundOption:[],
  92. currentInfo:{},
  93. reduceItemId:0,
  94. reduceShow:false,
  95. reduceNum:0,
  96. };
  97. },
  98. methods: {
  99. beginReduce(item){
  100. this.reduceShow = true
  101. this.reduceNum = item.xhNum
  102. this.refundItemId = item.id
  103. },
  104. confirmReduce(val){
  105. if (val.index === 0) {
  106. this.hideReduce()
  107. return false
  108. }
  109. let that = this
  110. refundReduce({reduceNum:this.reduceNum,refundItemId:this.refundItemId}).then(res=>{
  111. if(res.code == 1){
  112. that.hideReduce()
  113. that.init()
  114. }
  115. })
  116. },
  117. hideReduce(){
  118. this.reduceShow = false
  119. this.reduceNum = 0
  120. this.reduceItemId = 0
  121. },
  122. selOption(info){
  123. this.$refs.optionRef.open('center')
  124. this.currentInfo = info
  125. },
  126. cancelOption(){
  127. this.$refs.optionRef.close()
  128. },
  129. getOption(item){
  130. changeRefundOption({id:this.option.id,sonId:this.currentInfo.id,optionId:item.id}).then(res=>{
  131. if(res.code == 1){
  132. this.$msg('修改成功')
  133. this.init()
  134. this.$refs.optionRef.close()
  135. }
  136. })
  137. },
  138. beginWastage(item){
  139. this.wastageShow = true
  140. this.wastageNum = item.xhNum
  141. this.refundItemId = item.id
  142. },
  143. init(){
  144. let that = this
  145. refundDetail({ id: this.option.id }).then(res=>{
  146. that.info = res.data.info ? res.data.info : []
  147. that.itemList = res.data.itemList ? res.data.itemList : []
  148. that.refundOption = res.data.itemRefundOption?res.data.itemRefundOption:[]
  149. })
  150. },
  151. goBack() {
  152. uni.navigateBack({})
  153. },
  154. hideWaste(){
  155. this.wastageShow = false
  156. this.wastageNum = 0
  157. },
  158. confirmWastage(val){
  159. if (val.index === 0) {
  160. this.hideWaste()
  161. return false
  162. }
  163. let that = this
  164. refundWaste({wasteNum:this.wastageNum,remark:'退货时报损',refundItemId:this.refundItemId}).then(res=>{
  165. if(res.code == 1){
  166. that.hideWaste()
  167. that.init()
  168. }
  169. })
  170. }
  171. },
  172. };
  173. </script>
  174. <style lang="scss" scoped>
  175. .admin-button-com {
  176. margin-bottom: 20upx;
  177. width: 100%;
  178. }
  179. .class-popup-style{
  180. z-index:99999;
  181. }
  182. .staff-btn {
  183. min-width: 160upx;
  184. padding: 0 27upx;
  185. height: 80upx;
  186. font-size: 40upx;
  187. font-weight: bold;
  188. margin: 8upx 8upx 0 0;
  189. border-radius: 16upx;
  190. background: #f0f2f6;
  191. color: #333;
  192. border: 2upx solid #e0e0e0;
  193. transition: none;
  194. display: flex;
  195. align-items: center;
  196. justify-content: center;
  197. }
  198. .staff-btn.selected,
  199. .staff-btn:active {
  200. background: #f0f2f6;
  201. color: #333;
  202. border-color: #e0e0e0;
  203. }
  204. </style>