index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item label="票务名称">
  5. <el-input
  6. v-model="queryParams.goodsName"
  7. placeholder="请输入票务名称"
  8. clearable
  9. style="width: 200px;"
  10. @keyup.enter.native="handleQuery"
  11. />
  12. </el-form-item>
  13. <el-form-item label="票档名称">
  14. <el-input
  15. v-model="queryParams.seatTypeName"
  16. placeholder="请输入票档名称"
  17. clearable
  18. style="width: 200px;"
  19. @keyup.enter.native="handleQuery"
  20. />
  21. </el-form-item>
  22. <el-form-item label="团队名称" v-if="['group'].includes(channelType)">
  23. <el-input
  24. v-model="queryParams.teamName"
  25. placeholder="请输入团队名称"
  26. clearable
  27. style="width: 200px;"
  28. @keyup.enter.native="handleQuery"
  29. />
  30. </el-form-item>
  31. <el-form-item>
  32. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  33. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  34. </el-form-item>
  35. </el-form>
  36. <el-row :gutter="10" class="mb8">
  37. <el-col :span="1.5">
  38. <el-button
  39. type="primary"
  40. plain
  41. icon="el-icon-plus"
  42. size="mini"
  43. @click="handleAdd"
  44. v-hasPermi="configPermi.add"
  45. >价格设置</el-button>
  46. </el-col>
  47. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  48. </el-row>
  49. <el-table ref="tables" v-loading="loading" :data="dataList" border>
  50. <el-table-column label="序号" align="center" type="index" width="50"></el-table-column>
  51. <el-table-column label="票务名称" align="center" prop="goodsName" />
  52. <el-table-column label="票档名称" align="center" prop="seatTypeName" />
  53. <el-table-column width="220" v-if="['group'].includes(channelType)" label="成团要求" align="center" prop="originalAmount11">
  54. <template slot-scope="scope">
  55. <div>
  56. <div
  57. v-for="(item,index) in setTourist(scope.row)"
  58. :key="index"
  59. >
  60. {{ item.label }}{{ item.info }}
  61. </div>
  62. </div>
  63. </template>
  64. </el-table-column>
  65. <el-table-column v-if="!['window','group'].includes(channelType)" :label="setSaleAmounttile1()" align="center" prop="originalAmount" />
  66. <el-table-column :label="setSaleAmounttile()" align="center" prop="saleAmount" />
  67. <el-table-column v-if="channelType == 'retail'" label="佣金比例(%)" align="center" prop="retailRate" />
  68. <el-table-column v-if="['retail'].includes(channelType)" label="佣金(元)" align="center" prop="retailAmount" />
  69. <el-table-column label="创建人" align="center" prop="createBy" />
  70. <el-table-column label="最后修改时间" align="center" prop="updateTime" />
  71. <el-table-column label="备注" align="center" prop="remark" />
  72. <el-table-column label="状态" align="center">
  73. <template slot-scope="scope">
  74. <switchBoxVue v-model="scope.row.priceStatus" @changeFun="ionlineApi(scope.row)" :active-value="1" />
  75. </template>
  76. </el-table-column>
  77. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  78. <template slot-scope="scope">
  79. <span v-hasPermi="configPermi.edit" style="display: inline-block;">
  80. <el-button
  81. size="mini"
  82. type="text"
  83. style="margin-left: 10px;"
  84. @click="handleEdit(scope.row)"
  85. v-if="['group'].includes(channelType)"
  86. >编辑</el-button>
  87. </span>
  88. <span v-hasPermi="configPermi.deatils" style="display: inline-block;">
  89. <el-button
  90. size="mini"
  91. type="text"
  92. style="margin-left: 10px;"
  93. @click="handleUpdate(scope.row)"
  94. v-if="!['group'].includes(channelType)"
  95. >价格日历</el-button>
  96. </span>
  97. <span v-hasPermi="configPermi.tuandui" style="display: inline-block;">
  98. <el-button
  99. v-if="['group'].includes(channelType)"
  100. size="mini"
  101. type="text"
  102. style="margin-left: 10px;"
  103. @click="bindTeamFun(scope.row)"
  104. >绑定团队</el-button>
  105. </span>
  106. <span v-hasPermi="configPermi.del" style="display: inline-block;">
  107. <el-button
  108. size="mini"
  109. type="text"
  110. style="margin-left: 10px;"
  111. @click="handleDelete(scope.row,scope.index)"
  112. >删除</el-button>
  113. </span>
  114. </template>
  115. </el-table-column>
  116. </el-table>
  117. <pagination
  118. v-show="total>0"
  119. :total="total"
  120. :page.sync="queryParams.pageNum"
  121. :limit.sync="queryParams.pageSize"
  122. @pagination="getList"
  123. />
  124. <!-- 新增/编辑弹框 -->
  125. <add-and-edit
  126. ref="addAndEdit"
  127. @getList="getList"
  128. :channelType="channelType"
  129. />
  130. <!-- 日历价格 -->
  131. <calendarBox ref="calendarBox" :channelType="channelType" />
  132. <!-- 绑定团队 -->
  133. <!-- <bindTeamBox ref="bindTeamBox" /> -->
  134. <!-- 绑定团队 -->
  135. <bindTeamBoxNew :dict="dict" ref="bindTeamBoxNew" />
  136. </div>
  137. </template>
  138. <script>
  139. import { pageList, deleteById, updateById } from '@/api/priceConfiguration/index'
  140. import addAndEdit from "./dialog/addAndEdit.vue";
  141. import calendarBox from './dialog/calendarBox.vue';
  142. import switchBoxVue from '@/components/switchBox.vue';
  143. import bindTeamBox from './dialog/bindTeamBox.vue';
  144. import bindTeamBoxNew from './dialog/bindTeamBoxNew.vue';
  145. export default {
  146. name: "PriceConfigurationUilt",
  147. dicts: ['distribution_type', 'team_type'],
  148. components: { addAndEdit,calendarBox,switchBoxVue,bindTeamBox,bindTeamBoxNew },
  149. data() {
  150. return {
  151. // 遮罩层
  152. loading: true,
  153. configPermi: {
  154. add: [],
  155. del: [],
  156. deatils: [],
  157. tuandui: []
  158. },
  159. // 选中数组
  160. ids: [],
  161. // 非单个禁用
  162. single: true,
  163. // 非多个禁用
  164. multiple: true,
  165. // 显示搜索条件
  166. showSearch: true,
  167. // 总条数
  168. total: 0,
  169. // 用户表格数据
  170. dataList: [],
  171. // 弹出层标题
  172. title: "",
  173. // 查询参数
  174. queryParams: {
  175. pageNum: 1,
  176. pageSize: 10,
  177. type: undefined
  178. },
  179. /**
  180. * 查询的时候 channelType渠道类型: 来自字典channel_type. applet小程序 retail分销 window窗口 group团购
  181. *
  182. */
  183. channelType: ''
  184. };
  185. },
  186. created() {
  187. this.channelType = this.$route.query.channelTyp
  188. this.configPermi = {
  189. add: [`${this.channelType}:priceConfigurationUitl:add`],
  190. del: [`${this.channelType}:priceConfigurationUitl:deatils`],
  191. deatils: [`${this.channelType}:priceConfigurationUitl:deatils`],
  192. tuandui: [`${this.channelType}:priceConfigurationUitl:tuandui`],
  193. edit: [`${this.channelType}:priceConfigurationUitl:edit`],
  194. }
  195. this.getList();
  196. },
  197. methods: {
  198. /** 查询列表 */
  199. getList() {
  200. this.loading = true;
  201. pageList(this.addDateRange({ ...this.queryParams,channelType: this.channelType }))
  202. .then(response => {
  203. this.dataList = response.rows;
  204. this.total = response.total;
  205. this.loading = false;
  206. }
  207. );
  208. },
  209. // 取消按钮
  210. cancel() {
  211. this.open = false;
  212. },
  213. /** 搜索按钮操作 */
  214. handleQuery() {
  215. this.queryParams.pageNum = 1;
  216. this.getList();
  217. },
  218. /** 重置按钮操作 */
  219. resetQuery() {
  220. this.dateRange = [];
  221. this.queryParams = {
  222. pageNum: 1,
  223. pageSize: this.queryParams.pageSize
  224. }
  225. this.handleQuery();
  226. },
  227. /** 新增按钮操作 */
  228. handleAdd() {
  229. this.$refs["addAndEdit"].openDialog("新增数据", null);
  230. },
  231. /** 修改按钮操作 */
  232. handleEdit(row) {
  233. this.$refs["addAndEdit"].openDialog("新增数据", row);
  234. },
  235. /** 日历 */
  236. handleUpdate(row) {
  237. this.$refs["calendarBox"].openDialog("修改数据", row);
  238. },
  239. /** 绑定团队 */
  240. bindTeamFun(row) {
  241. // this.$refs["bindTeamBox"].openDialog("绑定团队", row);
  242. this.$refs["bindTeamBoxNew"].openDialog("绑定团队", row);
  243. },
  244. /** 警用和启用 */
  245. ionlineApi(row) {
  246. this.$confirm("您确认要将该票的价格信息进行" + (row.priceStatus == 1 ? '禁用吗?' : '启用吗?'), '提示', {
  247. confirmButtonText: '确定',
  248. cancelButtonText: '取消',
  249. type: 'warning'
  250. }).then(() => {
  251. updateById({ id: row.id, priceStatus: row.priceStatus == 1 ? 0 : 1 }).then((res) => {
  252. if (res.code == 200) {
  253. this.$message({
  254. type: 'success',
  255. message: '操作成功!'
  256. });
  257. this.getList();
  258. }
  259. });
  260. }).catch(() => {this.getList();});
  261. },
  262. /** 删除按钮操作 */
  263. handleDelete(row) {
  264. this.$modal.confirm('您确认要将该票的价格信息进行删除吗?').then(function() {
  265. return deleteById({id: row.id});
  266. }).then(() => {
  267. this.getList();
  268. this.$modal.msgSuccess("删除成功");
  269. }).catch(() => {});
  270. },
  271. /** */
  272. setSaleAmounttile1(){
  273. let str = '划线价(元)'
  274. if(this.channelType == "applet") {
  275. str = "划线价(元)"
  276. }
  277. if(this.channelType == "retail") {
  278. str = "销售价(元)"
  279. }
  280. if(this.channelType == "window") {
  281. str = "划线价(元)"
  282. }
  283. if(this.channelType == "group") {
  284. str = "划线价(元)"
  285. }
  286. return str
  287. },
  288. /** */
  289. setSaleAmounttile(){
  290. let str = '销售价(元)'
  291. if(this.channelType == "applet") {
  292. str = "销售价(元)"
  293. }
  294. if(this.channelType == "retail") {
  295. str = "分销价(元)"
  296. }
  297. if(this.channelType == "window") {
  298. str = "销售价(元)"
  299. }
  300. if(this.channelType == "group") {
  301. str = "销售价(元)"
  302. }
  303. return str
  304. },
  305. setTourist(row) {
  306. let list = [
  307. { label: '价格类型:',info: ["一人一价",'一口价'][row.priceType] },
  308. { label: '游客限制类型:',info: ["不限制",'限制最低人数','限制人数范围'][row.touristLimit] },
  309. ]
  310. if(row.touristLimit == 1) {
  311. list.push({
  312. label: '游客限制最小值:',info: row.touristMin + "人"
  313. })
  314. }else if(row.touristLimit == 2){
  315. list.push({
  316. label: '游客限制:',info: row.touristMin + "人" + "-" +row.touristMax + "人"
  317. })
  318. }
  319. return list
  320. }
  321. },
  322. };
  323. </script>