rebate_list-confirm.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. <template>
  2. <div>
  3. <div class="sty">
  4. <el-page-header @back="goBack" content="销售返利单"> </el-page-header>
  5. </div>
  6. <br />
  7. <br />
  8. <span>返利单</span>
  9. <el-divider></el-divider>
  10. <!-- 表头 -->
  11. <div>
  12. <el-form ref="searchForm" :model="searchForm" label-width="100px" size="small" label-position="left">
  13. <el-row :gutter="20">
  14. <el-col :xs="24" :sm="12" :lg="6">
  15. <el-form-item label="返利单号" prop="">
  16. <el-input disabled v-model="searchForm.rebateOrderId" placeholder=""></el-input>
  17. </el-form-item>
  18. </el-col>
  19. <el-col :xs="24" :sm="12" :lg="6">
  20. <el-form-item label="返利日期" prop="">
  21. <el-input disabled v-model="searchForm.theTime" placeholder=""></el-input>
  22. </el-form-item>
  23. </el-col>
  24. <el-col :xs="24" :sm="12" :lg="6">
  25. <el-form-item label="备注" prop="">
  26. <el-input disabled v-model="searchForm.remark" placeholder=""></el-input>
  27. </el-form-item>
  28. </el-col>
  29. <el-col :xs="24" :sm="12" :lg="6">
  30. <el-form-item label="制单人" prop="">
  31. <el-input disabled v-model="searchForm.createBy" placeholder=""></el-input>
  32. </el-form-item>
  33. </el-col>
  34. <el-col :xs="24" :sm="12" :lg="6">
  35. <el-form-item label="制单日期" prop="">
  36. <el-input disabled v-model="searchForm.createTime" placeholder=""></el-input>
  37. </el-form-item>
  38. </el-col>
  39. <el-col :xs="24" :sm="12" :lg="6">
  40. <el-form-item label="审批人" prop="">
  41. <el-input v-if="this.searchForm.secondExamineBy != null" disabled v-model="searchForm.secondExamineBy"
  42. placeholder=""></el-input>
  43. <el-input v-else disabled v-model="searchForm.examineBy" placeholder=""></el-input>
  44. </el-form-item>
  45. </el-col>
  46. <el-col :xs="24" :sm="12" :lg="6">
  47. <el-form-item label="审批日期" prop="">
  48. <el-input v-if="this.searchForm.secondExamineTime != null" disabled v-model="searchForm.secondExamineTime"
  49. placeholder=""></el-input>
  50. <el-input v-else disabled v-model="searchForm.examineTime" placeholder=""></el-input>
  51. </el-form-item>
  52. </el-col>
  53. </el-row>
  54. </el-form>
  55. </div>
  56. <!-- 列表 -->
  57. <div class="mymain-container">
  58. <div class="table">
  59. <el-table v-loading="listLoading" :data="dataList" element-loading-text="Loading" border fit
  60. highlight-current-row stripe>
  61. <el-table-column label="序号" align="left" width="100" type="index" show-overflow-tooltip></el-table-column>
  62. <el-table-column align="left" label="返利类型" prop="walletName" min-width="160"
  63. show-overflow-tooltip></el-table-column>
  64. <el-table-column align="right" label="总返利金额" prop="amount" min-width="160" show-overflow-tooltip>
  65. <!-- <template slot-scope="scope">
  66. </template> -->
  67. </el-table-column>
  68. <el-table-column align="right" label="返利金额" prop="" min-width="160" show-overflow-tooltip>
  69. <template slot-scope="scope">
  70. <el-input style="width: 100%" class="mountclass" :disabled="show" type="number"
  71. v-model="scope.row.rebateAmount"></el-input>
  72. </template>
  73. </el-table-column>
  74. <!-- <el-table-column align="right" label="折让金额" prop="" min-width="160" show-overflow-tooltip>-->
  75. <!-- <template slot-scope="scope">-->
  76. <!-- <el-input-->
  77. <!-- class="mountclass"-->
  78. <!-- :disabled="show"-->
  79. <!-- type="number"-->
  80. <!-- @mousewheel.native.prevent-->
  81. <!-- v-model="scope.row.allowanceAmount"-->
  82. <!-- ></el-input>-->
  83. <!-- </template>-->
  84. <!-- </el-table-column>-->
  85. <!-- <el-table-column-->
  86. <!-- align="left"-->
  87. <!-- label="备注"-->
  88. <!-- prop="policyDocNo"-->
  89. <!-- min-width="160"-->
  90. <!-- show-overflow-tooltip-->
  91. <!-- ></el-table-column>-->
  92. <el-table-column align="left" label="备注1" prop="remark1" min-width="160"
  93. show-overflow-tooltip></el-table-column>
  94. <el-table-column align="left" label="备注2" prop="remark2" min-width="160"
  95. show-overflow-tooltip></el-table-column>
  96. </el-table>
  97. </div>
  98. </div>
  99. <br />
  100. <div v-if="!show">
  101. <el-button type="primary" size="small" @click="btnFn">确定</el-button>
  102. <el-button type="primary" size="small" @click="resetFn">重置</el-button>
  103. </div>
  104. </div>
  105. </template>
  106. <script>
  107. import { getRebateOrderDetail, getRebateOrderAck, getRebateOrderAclUpdate } from '@/api/finance/rebate_list'
  108. export default {
  109. props: {
  110. detailId: {
  111. type: String,
  112. required: true
  113. },
  114. isShow: {
  115. type: Boolean,
  116. required: true
  117. }
  118. },
  119. data() {
  120. return {
  121. state: null,
  122. examineStatus: '',
  123. searchForm: {
  124. rebateOrderId: '',
  125. theTime: '',
  126. createBy: '',
  127. createTime: '',
  128. remark: ''
  129. },
  130. dataList: [],
  131. saveDataList: [],
  132. listLoading: false // 列表加载loading
  133. }
  134. },
  135. computed: {
  136. isCustomer() {
  137. return this.$store.getters.customerId && this.$store.getters.customerNumber
  138. },
  139. show() {
  140. if (this.isShow && this.examineStatus == 'OK_ONE') {
  141. this.state = 1
  142. if (this.isCustomer) {
  143. return true
  144. }
  145. return false
  146. } else if (!this.isShow) {
  147. this.state = 2
  148. console.log(33);
  149. return false
  150. } else if (this.isShow && (this.examineStatus == 'OK' || this.examineStatus == 'FAIL')) {
  151. return true
  152. }
  153. }
  154. },
  155. created() {
  156. this.getDataList()
  157. },
  158. methods: {
  159. //深拷贝数据
  160. deepCopy(data) {
  161. //string,number,bool,null,undefined,symbol
  162. //object,array,date
  163. if (data && typeof data === 'object') {
  164. //针对函数的拷贝
  165. if (typeof data === 'function') {
  166. let tempFunc = data.bind(null)
  167. tempFunc.prototype = this.deepCopy(data.prototype)
  168. return tempFunc
  169. }
  170. switch (Object.prototype.toString.call(data)) {
  171. case '[object String]':
  172. return data.toString()
  173. case '[object Number]':
  174. return Number(data.toString())
  175. case '[object Boolean]':
  176. return Boolean(data.toString())
  177. case '[object Date]':
  178. return new Date(data.getTime())
  179. case '[object Array]':
  180. var arr = []
  181. for (let i = 0; i < data.length; i++) {
  182. arr[i] = this.deepCopy(data[i])
  183. }
  184. return arr
  185. //js自带对象或用户自定义类实例
  186. case '[object Object]':
  187. var obj = {}
  188. for (let key in data) {
  189. //会遍历原型链上的属性方法,可以用hasOwnProperty来控制 (obj.hasOwnProperty(prop)
  190. obj[key] = this.deepCopy(data[key])
  191. }
  192. return obj
  193. }
  194. } else {
  195. //string,number,bool,null,undefined,symbol
  196. return data
  197. }
  198. },
  199. //重置
  200. resetFn() {
  201. // console.log(this.dataList, this.saveDataList);
  202. this.dataList = this.saveDataList
  203. this.saveDataList = this.deepCopy(this.dataList)
  204. },
  205. //确定
  206. async btnFn() {
  207. // console.log(this.dataList);
  208. const res = this.dataList.map(v => {
  209. return {
  210. // allowanceAmount: v.allowanceAmount,
  211. allowanceAmount: 0,
  212. rebateAmount: v.rebateAmount,
  213. itemId: v.id
  214. }
  215. })
  216. if (this.state == 1) {
  217. await getRebateOrderAclUpdate(res)
  218. this.$message.success('编辑成功')
  219. } else {
  220. await getRebateOrderAck(res)
  221. this.$message.success('确认成功')
  222. }
  223. this.$emit('updateList')
  224. this.$parent.showPage = 1
  225. },
  226. //获取详情数据
  227. async getDataList() {
  228. let res = await getRebateOrderDetail({ id: this.detailId })
  229. this.okId = res.data.id
  230. this.searchForm.rebateOrderId = res.data.id
  231. this.searchForm.theTime = res.data.theTime
  232. this.searchForm.createBy = res.data.createBy
  233. this.searchForm.createTime = res.data.createTime
  234. this.searchForm.remark = res.data.remark
  235. this.searchForm.secondExamineBy = res.data.secondExamineBy
  236. this.searchForm.secondExamineTime = res.data.secondExamineTime
  237. this.searchForm.examineBy = res.data.examineBy
  238. this.searchForm.examineTime = res.data.examineTime
  239. this.examineStatus = res.data.items[0].examineStatus
  240. this.saveDataList = this.deepCopy(res.data.items)
  241. this.dataList = res.data.items
  242. if (this.state != 1) {
  243. this.dataList.forEach(k => {
  244. k.rebateAmount = k.amount
  245. })
  246. }
  247. },
  248. goBack() {
  249. this.$parent.showPage = 1
  250. }
  251. }
  252. }
  253. </script>
  254. <style lang="scss" scoped>
  255. ::v-deep .mountclass {
  256. input {
  257. text-align: right;
  258. width: 100%;
  259. }
  260. }
  261. </style>