Dzk_RuleList.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. <template>
  2. <div v-if="pageStatus == 0">配置加载中...</div>
  3. <div v-else-if="pageStatus == 1">此页面不对此账号开放</div>
  4. <div v-else-if="pageStatus == 2">没有此页内容的配置权限,请检查集团上的配置</div>
  5. <div v-else-if="pageStatus == 3">加载发生错误</div>
  6. <div v-else-if="pageStatus == 4" class="app-container">
  7. <el-form :model="sumForm">
  8. <el-form-item label="电子卡启动状态">
  9. {{ sumForm.cardEnabledFlag == 0 ? "未开启" : "已开启" }}
  10. </el-form-item>
  11. <el-form-item
  12. label="目前启动的电子卡"
  13. v-if="sumForm.cardEnabledFlag == 1"
  14. >
  15. {{
  16. sumForm.cardOilsType.length == 0
  17. ? "你尚未选择要启动的电子卡"
  18. : sumForm.cardOilsType.join(", ")
  19. }}
  20. </el-form-item>
  21. <!-- <el-form-item
  22. label="所有积分规则的失效时间"
  23. v-if="sumForm.termDateManage == 2"
  24. >
  25. {{
  26. sumForm.termDateManage == 0 ? "积分规则永久有效" : sumForm.emptyDate
  27. }}
  28. </el-form-item>
  29. <el-form-item label="多倍积分活动的状态">
  30. {{
  31. sumForm.integralActivity == 0 ? "未开启" : integralActivityDatePicker
  32. }}
  33. </el-form-item> -->
  34. <el-form-item
  35. label="正在生效中的充值规则"
  36. v-if="sumForm.cardEnabledFlag == 1"
  37. >
  38. {{ sumForm.detailList.length===0 ? "你尚没有正在生效的规则":"" }}
  39. <el-table :data="sumForm.detailList" v-if="sumForm.detailList.length!==0">
  40. <af-table-column
  41. label="电子卡"
  42. align="center"
  43. :formatter="oilNameFormatter"
  44. />
  45. <af-table-column label="条件" align="center" prop="discountAmtTerm">
  46. <template slot-scope="scope1">
  47. {{ scope1.row.discountAmtStart }}≤充值金额(元)&lt;{{
  48. scope1.row.discountAmtEnd
  49. }}
  50. </template>
  51. </af-table-column>
  52. <af-table-column label="赠送" align="center">
  53. <template slot-scope="scope">
  54. {{
  55. scope.row.settingRuleType == 1
  56. ? "按金额赠送"
  57. : scope.row.settingRuleType == 2
  58. ? "按比例赠送"
  59. : ""
  60. }}
  61. --- 额度为 {{ scope.row.presentAmt }}
  62. {{
  63. scope.row.settingRuleType == "1"
  64. ? "元"
  65. : scope.row.settingRuleType == "2"
  66. ? "%"
  67. : ""
  68. }}
  69. </template>
  70. </af-table-column>
  71. </el-table>
  72. </el-form-item>
  73. <el-form-item
  74. label="电子卡会叠加的优惠方案"
  75. v-if="sumForm.cardEnabledFlag == 1"
  76. >
  77. <div>
  78. {{ sumForm.isMarket == 1 ? "营销方案 ":""}}
  79. {{ sumForm.isGradeSetting == 1 ? "等级优惠 ":""}}
  80. {{ sumForm.isDiscountCoupon == 1 ? "优惠券 ":""}}
  81. {{ sumForm.isLabel == 1 ? "标签 ":""}}
  82. {{ sumForm.isMarket == 1 || sumForm.isGradeSetting == 1 || sumForm.isDiscountCoupon == 1 ? '' : "您未启动叠加,电子卡不会执行任何优惠方案" }}
  83. </div>
  84. </el-form-item>
  85. <el-form-item
  86. label="充值活动"
  87. v-if="sumForm.cardEnabledFlag == 1"
  88. >
  89. {{
  90. sumForm.discountTimeSetting == 0 ? "未开启" : integralActivityDatePicker
  91. }}
  92. </el-form-item>
  93. </el-form>
  94. </div>
  95. </template>
  96. <script>
  97. import { listDetailInfo } from "@/api/customer/cardSettingDetail";
  98. import { selectCustomerCardSetting } from "@/api/customer/cardSetting";
  99. export default {
  100. name: "Dzk_RuleList",
  101. data() {
  102. return {
  103. // 总条数
  104. total: 0,
  105. // 客户电子会员卡充值优惠设置明细表格数据
  106. detailList: [],
  107. // 弹出层标题
  108. title: "",
  109. // 是否显示弹出层
  110. open: false,
  111. // 查询参数
  112. queryParams: {
  113. pageNum: 1,
  114. pageSize: 10,
  115. },
  116. // 表单参数
  117. form: {},
  118. // 表单校验
  119. rules: {},
  120. sumForm: {},
  121. timeSelect: [
  122. ,
  123. ["周天", "周一", "周二", "周三", "周四", "周五", "周六"],
  124. [
  125. "1号",
  126. "2号",
  127. "3号",
  128. "4号",
  129. "5号",
  130. "6号",
  131. "7号",
  132. "8号",
  133. "9号",
  134. "10号",
  135. "11号",
  136. "12号",
  137. "13号",
  138. "14号",
  139. "15号",
  140. "16号",
  141. "17号",
  142. "18号",
  143. "19号",
  144. "20号",
  145. "21号",
  146. "22号",
  147. "23号",
  148. "24号",
  149. "25号",
  150. "26号",
  151. "27号",
  152. "28号",
  153. "29号",
  154. "30号",
  155. "31号",
  156. ],
  157. ],
  158. pageStatus: 0,
  159. };
  160. },
  161. created() {
  162. this.setPageStatus();
  163. this.getList();
  164. this.init();
  165. },
  166. computed:{
  167. integralActivityDatePicker() {
  168. if (!this.sumForm.discountTime) {
  169. return "";
  170. }
  171. if (this.sumForm.integralActivity == 0) {
  172. return "";
  173. }
  174. let timeString = "";
  175. const discountTimeType = this.sumForm.discountTimeType;
  176. if (discountTimeType == 1) {
  177. timeString += "每周的";
  178. }
  179. if (discountTimeType == 2) {
  180. timeString += "每月的";
  181. }
  182. if (discountTimeType == 3) {
  183. timeString += "指定的日期 ";
  184. }
  185. if (discountTimeType == 1 || discountTimeType == 2) {
  186. this.sumForm.discountTime.forEach((ele) => {
  187. timeString += this.timeSelect[discountTimeType][ele] + "、";
  188. });
  189. } else if (discountTimeType == 3) {
  190. console.log(this.sumForm.discountTime);
  191. timeString += this.sumForm.discountTime.toString();
  192. }
  193. timeString = timeString.replace(/(、)$/g, "") + " 享受赠送比例是" + this.sumForm.presentScale + '%的活动优惠';
  194. return timeString;
  195. },
  196. },
  197. methods: {
  198. init() {
  199. selectCustomerCardSetting().then((response) => {
  200. this.sumForm = response.data;
  201. const cardOilsType = this.sumForm.cardOilsType == null ? "" : this.sumForm.cardOilsType
  202. this.sumForm.cardOilsType = cardOilsType
  203. .split(",")
  204. .filter((ele) => {
  205. return ele != "";
  206. });
  207. this.sumForm.detailList = this.sumForm.detailList.filter((ele)=>{
  208. return this.sumForm.cardOilsType.includes(ele.cardType)
  209. })
  210. const oilType = ['',"汽油卡", "柴油卡", "非油品卡", "LNG卡", "CNG卡"];
  211. this.sumForm.cardOilsType.map((ele, index) => {
  212. this.sumForm.cardOilsType[index] = oilType[ele];
  213. });
  214. if (
  215. this.sumForm.discountTimeType == "1" ||
  216. this.sumForm.discountTimeType == "2"
  217. ) {
  218. // if( this.form.discountTime == ""){
  219. // this.form.discountTime = [];
  220. // }
  221. this.sumForm.discountTime = this.sumForm.discountTime
  222. .split(",")
  223. .map(parseFloat);
  224. } else if (this.sumForm.discountTimeType == "3") {
  225. if (this.sumForm.discountTime.length == 0) {
  226. this.sumForm.discountTime = [];
  227. } else {
  228. this.sumForm.discountTime = this.sumForm.discountTime.split(
  229. ","
  230. );
  231. }
  232. }
  233. });
  234. },
  235. setPageStatus() {
  236. this.queryPageStatus([1,2],2).then((res) => {
  237. this.pageStatus = res;
  238. });
  239. },
  240. oilNameFormatter(row, column) {
  241. if (row.cardType === "1") {
  242. return "汽油卡";
  243. } else if (row.cardType === "2") {
  244. return "柴油卡";
  245. } else if (row.cardType === "3") {
  246. return "非油品卡";
  247. } else if (row.cardType === "4") {
  248. return "LNG卡";
  249. } else if (row.cardType === "5") {
  250. return "CNG卡";
  251. } else {
  252. return row.cardType;
  253. }
  254. },
  255. /** 查询客户电子会员卡充值优惠设置明细列表 */
  256. getList() {
  257. listDetailInfo(this.queryParams).then((response) => {
  258. this.detailList = response.rows;
  259. this.total = response.total;
  260. });
  261. },
  262. },
  263. };
  264. </script>