index.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  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="订单号" prop="orderSn">
  5. <el-input
  6. style="width: 220px"
  7. v-model="queryParams.orderSn"
  8. placeholder="请输入订单号"
  9. clearable
  10. size="small"
  11. @keyup.enter.native="handleQuery"
  12. />
  13. </el-form-item>
  14. <el-form-item label="公司名" prop="companyId">
  15. <el-select filterable style="width: 220px" v-model="queryParams.companyId" placeholder="请选择公司名" clearable size="small">
  16. <el-option
  17. v-for="item in companys"
  18. :key="item.companyId"
  19. :label="item.companyName"
  20. :value="item.companyId"
  21. />
  22. </el-select>
  23. </el-form-item>
  24. <el-form-item label="创建时间" prop="createTime">
  25. <el-date-picker v-model="dateRange" size="small" style="width: 220px" value-format="yyyy-MM-dd" type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
  26. </el-form-item>
  27. <el-form-item label="状态" prop="status">
  28. <el-select style="width: 220px" v-model="queryParams.status" placeholder="请选择状态" clearable size="small">
  29. <el-option
  30. v-for="dict in statusOptions"
  31. :key="dict.dictValue"
  32. :label="dict.dictLabel"
  33. :value="dict.dictValue"
  34. />
  35. </el-select>
  36. </el-form-item>
  37. <el-form-item>
  38. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  39. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  40. </el-form-item>
  41. </el-form>
  42. <el-row :gutter="10" class="mb8">
  43. <el-col :span="1.5">
  44. <el-button
  45. type="warning"
  46. icon="el-icon-download"
  47. size="mini"
  48. @click="handleExport"
  49. v-hasPermi="['company:companyVoicePackageOrder:export']"
  50. >导出</el-button>
  51. </el-col>
  52. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  53. </el-row>
  54. <el-table height="500" border v-loading="loading" :data="companyVoicePackageOrderList" @selection-change="handleSelectionChange">
  55. <el-table-column type="selection" width="55" align="center" />
  56. <el-table-column label="ID" align="center" prop="orderId" />
  57. <el-table-column label="订单号" align="center" prop="orderSn" />
  58. <el-table-column label="公司名称" align="center" prop="companyName" />
  59. <el-table-column label="套餐" align="center" prop="packageName" />
  60. <el-table-column label="价格" align="center" prop="price" />
  61. <el-table-column label="时长" align="center" prop="times" />
  62. <el-table-column label="状态" align="center" prop="status" >
  63. <template slot-scope="scope">
  64. <el-tag prop="status" v-for="(item, index) in statusOptions" :type="scope.row.status==1?'success':'danger'" v-if="scope.row.status==item.dictValue">{{item.dictLabel}}</el-tag>
  65. </template>
  66. </el-table-column>
  67. <el-table-column label="创建时间" align="center" prop="createTime" width="180">
  68. </el-table-column>
  69. <el-table-column label="支付时间" align="center" prop="payTime" width="180">
  70. </el-table-column>
  71. </el-table>
  72. <pagination
  73. v-show="total>0"
  74. :total="total"
  75. :page.sync="queryParams.pageNum"
  76. :limit.sync="queryParams.pageSize"
  77. @pagination="getList"
  78. />
  79. </div>
  80. </template>
  81. <script>
  82. import { listCompanyVoicePackageOrder, getCompanyVoicePackageOrder, delCompanyVoicePackageOrder, addCompanyVoicePackageOrder, updateCompanyVoicePackageOrder, exportCompanyVoicePackageOrder } from "@/api/company/companyVoicePackageOrder";
  83. import { getCompanyList } from "@/api/company/company";
  84. export default {
  85. name: "CompanyVoicePackageOrder",
  86. data() {
  87. return {
  88. dateRange:[],
  89. companys:[],
  90. statusOptions:[],
  91. // 遮罩层
  92. loading: true,
  93. // 选中数组
  94. ids: [],
  95. // 非单个禁用
  96. single: true,
  97. // 非多个禁用
  98. multiple: true,
  99. // 显示搜索条件
  100. showSearch: true,
  101. // 总条数
  102. total: 0,
  103. // 套餐订单表格数据
  104. companyVoicePackageOrderList: [],
  105. // 弹出层标题
  106. title: "",
  107. // 是否显示弹出层
  108. open: false,
  109. // 查询参数
  110. queryParams: {
  111. pageNum: 1,
  112. pageSize: 10,
  113. orderSn: null,
  114. companyId: null,
  115. userId: null,
  116. packageId: null,
  117. price: null,
  118. times: null,
  119. remainTimes: null,
  120. isPay: null,
  121. payTime: null,
  122. status: null,
  123. payType: null,
  124. startTime: null,
  125. limitTime: null
  126. },
  127. // 表单参数
  128. form: {},
  129. // 表单校验
  130. rules: {
  131. }
  132. };
  133. },
  134. created() {
  135. getCompanyList().then(response => {
  136. this.companys = response.data;
  137. });
  138. this.getDicts("company_voice_package_order_status").then((response) => {
  139. this.statusOptions = response.data;
  140. });
  141. this.getList();
  142. },
  143. methods: {
  144. /** 查询套餐订单列表 */
  145. getList() {
  146. this.loading = true;
  147. listCompanyVoicePackageOrder(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
  148. this.companyVoicePackageOrderList = response.rows;
  149. this.total = response.total;
  150. this.loading = false;
  151. });
  152. },
  153. // 取消按钮
  154. cancel() {
  155. this.open = false;
  156. this.reset();
  157. },
  158. // 表单重置
  159. reset() {
  160. this.form = {
  161. orderId: null,
  162. orderSn: null,
  163. companyId: null,
  164. userId: null,
  165. packageId: null,
  166. price: null,
  167. times: null,
  168. remainTimes: null,
  169. isPay: null,
  170. createTime: null,
  171. payTime: null,
  172. status: 0,
  173. payType: null,
  174. startTime: null,
  175. limitTime: null
  176. };
  177. this.resetForm("form");
  178. },
  179. /** 搜索按钮操作 */
  180. handleQuery() {
  181. this.queryParams.pageNum = 1;
  182. this.getList();
  183. },
  184. /** 重置按钮操作 */
  185. resetQuery() {
  186. this.resetForm("queryForm");
  187. this.handleQuery();
  188. },
  189. // 多选框选中数据
  190. handleSelectionChange(selection) {
  191. this.ids = selection.map(item => item.orderId)
  192. this.single = selection.length!==1
  193. this.multiple = !selection.length
  194. },
  195. /** 新增按钮操作 */
  196. handleAdd() {
  197. this.reset();
  198. this.open = true;
  199. this.title = "添加套餐订单";
  200. },
  201. /** 修改按钮操作 */
  202. handleUpdate(row) {
  203. this.reset();
  204. const orderId = row.orderId || this.ids
  205. getCompanyVoicePackageOrder(orderId).then(response => {
  206. this.form = response.data;
  207. this.open = true;
  208. this.title = "修改套餐订单";
  209. });
  210. },
  211. /** 提交按钮 */
  212. submitForm() {
  213. this.$refs["form"].validate(valid => {
  214. if (valid) {
  215. if (this.form.orderId != null) {
  216. updateCompanyVoicePackageOrder(this.form).then(response => {
  217. if (response.code === 200) {
  218. this.msgSuccess("修改成功");
  219. this.open = false;
  220. this.getList();
  221. }
  222. });
  223. } else {
  224. addCompanyVoicePackageOrder(this.form).then(response => {
  225. if (response.code === 200) {
  226. this.msgSuccess("新增成功");
  227. this.open = false;
  228. this.getList();
  229. }
  230. });
  231. }
  232. }
  233. });
  234. },
  235. /** 删除按钮操作 */
  236. handleDelete(row) {
  237. const orderIds = row.orderId || this.ids;
  238. this.$confirm('是否确认删除套餐订单编号为"' + orderIds + '"的数据项?', "警告", {
  239. confirmButtonText: "确定",
  240. cancelButtonText: "取消",
  241. type: "warning"
  242. }).then(function() {
  243. return delCompanyVoicePackageOrder(orderIds);
  244. }).then(() => {
  245. this.getList();
  246. this.msgSuccess("删除成功");
  247. }).catch(function() {});
  248. },
  249. /** 导出按钮操作 */
  250. handleExport() {
  251. const queryParams = this.queryParams;
  252. this.$confirm('是否确认导出所有套餐订单数据项?', "警告", {
  253. confirmButtonText: "确定",
  254. cancelButtonText: "取消",
  255. type: "warning"
  256. }).then(function() {
  257. return exportCompanyVoicePackageOrder(queryParams);
  258. }).then(response => {
  259. this.download(response.msg);
  260. }).catch(function() {});
  261. }
  262. }
  263. };
  264. </script>