index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item label-width="120px" prop="orgId">
  5. <el-select v-model="queryParams.orgId" placeholder="请选择" clearable>
  6. <el-option-group label="工厂" v-if="sourceType == '01'">
  7. <template>
  8. <el-option v-for="factory in factoryList" :key="factory.id + factory.sourceType" :label="factory.name" :value="factory.id"> </el-option>
  9. </template>
  10. </el-option-group>
  11. <el-option-group label="门店" v-if="sourceType == '02'">
  12. <template>
  13. <el-option v-for="store in storeList" :key="store.id + store.sourceType" :label="store.name" :value="store.id"> </el-option>
  14. </template>
  15. </el-option-group>
  16. </el-select>
  17. </el-form-item>
  18. <el-form-item>
  19. <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
  20. <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
  21. </el-form-item>
  22. </el-form>
  23. <el-row :gutter="10" class="mb8">
  24. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  25. </el-row>
  26. <Page uri="/mapi/settlement/rate/list" :request-params="queryParams" ref="pagination">
  27. <el-table-column label="编号" align="center" prop="id" width="100px" />
  28. <el-table-column :label="sourceType == '01' ? '工厂名称' : '门店名称'" align="center">
  29. <template slot-scope="scope">
  30. <span v-if="scope.row.orgId == org.id && scope.row.sourceType == org.sourceType" v-for="org in orgList" :key="org.id + org.sourceType">
  31. {{ org.name }}
  32. </span>
  33. </template>
  34. </el-table-column>
  35. <el-table-column label="工厂结算费率" align="center" prop="factoryRate" v-if="sourceType == '02'" />
  36. <el-table-column label="材料费率" align="center" prop="materialRate" />
  37. <el-table-column label="管理费率" align="center" prop="manageRate" />
  38. <el-table-column label="押金费率" align="center" prop="depositRate" />
  39. <el-table-column label="云洗费率" align="center" prop="factoryRate" v-if="sourceType == '01'" />
  40. <el-table-column label="异店消费费率" align="center" prop="otherStoreRate" v-if="sourceType == '02'" />
  41. <el-table-column label="支付宝费率" align="center" prop="aliPayRate" v-if="sourceType == '02'" />
  42. <el-table-column label="微信费率" align="center" prop="wxPayRate" v-if="sourceType == '02'" />
  43. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="150">
  44. <template slot-scope="scope">
  45. <el-button type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['settlement:rate:edit']">修改</el-button>
  46. <!-- <el-button-->
  47. <!-- -->
  48. <!-- type="text"-->
  49. <!-- icon="el-icon-delete"-->
  50. <!-- @click="handleDelete(scope.row)"-->
  51. <!-- v-hasPermi="['settlement:rate:remove']"-->
  52. <!-- >删除</el-button>-->
  53. </template>
  54. </el-table-column>
  55. </Page>
  56. <!-- 添加或修改结算费率对话框 -->
  57. <el-dialog :title="title" :visible.sync="open" size="30%" append-to-body>
  58. <el-row :gutter="15">
  59. <el-form ref="form" :model="form" :rules="rules" label-width="130px">
  60. <el-col :span="24">
  61. <el-form-item :label="sourceType == '02' ? '工厂结算费率' : '云洗费率'" prop="factoryRate">
  62. <el-input-number v-model="form.factoryRate" :precision="4" :step="0.001" :max="1" />
  63. </el-form-item>
  64. <el-form-item label="材料费率" prop="materialRate">
  65. <el-input-number v-model="form.materialRate" :precision="4" :step="0.001" :max="1" />
  66. </el-form-item>
  67. <el-form-item label="管理费率" prop="manageRate">
  68. <el-input-number v-model="form.manageRate" :precision="4" :step="0.001" :max="1" />
  69. </el-form-item>
  70. <el-form-item label="押金费率" prop="depositRate">
  71. <el-input-number v-model="form.depositRate" :precision="4" :step="0.001" :max="1" />
  72. </el-form-item>
  73. <el-form-item label="异店消费费率" prop="otherStoreRate" v-if="sourceType == '02'">
  74. <el-input-number v-model="form.otherStoreRate" :precision="4" :step="0.001" :max="1" />
  75. </el-form-item>
  76. <el-form-item label="支付宝费率" prop="aliPayRate" v-if="sourceType == '02'">
  77. <el-input-number v-model="form.aliPayRate" :precision="4" :step="0.01" :max="1" />
  78. </el-form-item>
  79. <el-form-item label="微信费率" prop="wxPayRate" v-if="sourceType == '02'">
  80. <el-input-number v-model="form.wxPayRate" :precision="4" :step="0.01" :max="1" />
  81. </el-form-item>
  82. </el-col>
  83. </el-form>
  84. </el-row>
  85. <div slot="footer" class="dialog-footer">
  86. <el-button type="primary" @click="submitForm" style="margin-left: 5%">提交</el-button>
  87. <el-button @click="cancel">取 消</el-button>
  88. </div>
  89. </el-dialog>
  90. </div>
  91. </template>
  92. <script>
  93. import { listRate, getRate, delRate, addRate, updateRate, updateRateStatus } from '@/api/settlement/rate'
  94. import { allOrg } from '@/api/system/store'
  95. export default {
  96. name: 'Rate',
  97. data() {
  98. return {
  99. orgList: [],
  100. storeList: [],
  101. factoryList: [],
  102. // 遮罩层
  103. loading: true,
  104. // 选中数组
  105. ids: [],
  106. // 非单个禁用
  107. single: true,
  108. // 非多个禁用
  109. multiple: true,
  110. // 显示搜索条件
  111. showSearch: true,
  112. // 总条数
  113. total: 0,
  114. // 结算费率表格数据
  115. rateList: [],
  116. // 弹出层标题
  117. title: '',
  118. // 是否显示弹出层
  119. open: false,
  120. // 查询参数
  121. queryParams: {
  122. orgId: null
  123. },
  124. // 表单参数
  125. form: {},
  126. // 表单校验
  127. rules: {},
  128. sourceType: null
  129. }
  130. },
  131. created() {
  132. this.sourceType = this.getUrlParam('source_type')
  133. allOrg().then((res) => {
  134. this.orgList = res.data
  135. this.orgList.forEach((org) => {
  136. if (org.sourceType == '01') {
  137. this.factoryList.push(org)
  138. } else {
  139. this.storeList.push(org)
  140. }
  141. })
  142. })
  143. this.getList()
  144. },
  145. methods: {
  146. /** 查询结算费率列表 */
  147. getList() {
  148. this.queryParams.sourceType = this.sourceType
  149. this.$nextTick(() => {
  150. this.$refs.pagination.handleSearch(true)
  151. })
  152. },
  153. // 取消按钮
  154. cancel() {
  155. this.open = false
  156. this.reset()
  157. },
  158. // 表单重置
  159. reset() {
  160. this.form = {
  161. id: null,
  162. sourceType: null,
  163. orgId: null,
  164. factoryRate: null,
  165. materialRate: null,
  166. manageRate: null,
  167. depositRate: null,
  168. otherStoreRate: null,
  169. wxPayRate: null,
  170. aliPayRate: null
  171. }
  172. this.resetForm('form')
  173. },
  174. /** 搜索按钮操作 */
  175. handleQuery() {
  176. this.getList()
  177. },
  178. /** 重置按钮操作 */
  179. resetQuery() {
  180. this.resetForm('queryForm')
  181. this.handleQuery()
  182. },
  183. // 多选框选中数据
  184. handleSelectionChange(selection) {
  185. this.ids = selection.map((item) => item.id)
  186. this.single = selection.length !== 1
  187. this.multiple = !selection.length
  188. },
  189. /** 新增按钮操作 */
  190. handleAdd() {
  191. this.reset()
  192. this.open = true
  193. this.title = '添加结算费率'
  194. },
  195. /** 修改按钮操作 */
  196. handleUpdate(row) {
  197. this.reset()
  198. const id = row.id || this.ids
  199. getRate(id).then((response) => {
  200. this.form = response.data
  201. this.open = true
  202. this.title = '修改结算费率'
  203. })
  204. },
  205. /** 提交按钮 */
  206. submitForm() {
  207. this.$refs['form'].validate((valid) => {
  208. if (valid) {
  209. if (this.form.id != null) {
  210. updateRate(this.form).then((response) => {
  211. this.$modal.msgSuccess('修改成功')
  212. this.open = false
  213. this.getList()
  214. })
  215. } else {
  216. addRate(this.form).then((response) => {
  217. this.$modal.msgSuccess('新增成功')
  218. this.open = false
  219. this.getList()
  220. })
  221. }
  222. }
  223. })
  224. },
  225. /** 删除按钮操作 */
  226. handleDelete(row) {
  227. const ids = row.id || this.ids
  228. this.$modal
  229. .confirm('是否确认删除结算费率编号为"' + ids + '"的数据项?')
  230. .then(function () {
  231. return delRate(ids)
  232. })
  233. .then(() => {
  234. this.getList()
  235. this.$modal.msgSuccess('删除成功')
  236. })
  237. .catch(() => {})
  238. },
  239. /** 导出按钮操作 */
  240. handleExport() {
  241. this.download(
  242. 'mapi/settlement/rate/export',
  243. {
  244. ...this.queryParams
  245. },
  246. `rate_${new Date().getTime()}.xlsx`
  247. )
  248. },
  249. checkClose(done) {
  250. this.$confirm('是否关闭表单,关闭后数据将丢失?')
  251. .then(function () {
  252. done()
  253. })
  254. .then(() => {})
  255. .catch(() => {})
  256. }
  257. }
  258. }
  259. </script>