index.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. <template>
  2. <div class="app-container">
  3. <el-row :gutter="20">
  4. <!-- 站点重复报名设置 -->
  5. <el-col :span="8">
  6. <el-card shadow="hover" class="box-card" @click.native="openDialog('duplicate')">
  7. <div slot="header" class="clearfix">
  8. <span>站点重复报名设置</span>
  9. <el-button style="float: right; padding: 3px 0" type="text">设置</el-button>
  10. </div>
  11. <div class="card-content">
  12. <i class="el-icon-document-copy card-icon"></i>
  13. <p class="card-desc">配置学员报名规则及重复报名限制天数</p>
  14. </div>
  15. </el-card>
  16. </el-col>
  17. <!-- 全局熟客设置 -->
  18. <el-col :span="8">
  19. <el-card shadow="hover" class="box-card" @click.native="openDialog('regular')">
  20. <div slot="header" class="clearfix">
  21. <span>全局熟客设置</span>
  22. <el-button style="float: right; padding: 3px 0" type="text">设置</el-button>
  23. </div>
  24. <div class="card-content">
  25. <i class="el-icon-user-solid card-icon"></i>
  26. <p class="card-desc">配置全局熟客判断及小程序授权熟客逻辑</p>
  27. </div>
  28. </el-card>
  29. </el-col>
  30. <!-- 重复回传设置 -->
  31. <el-col :span="8">
  32. <el-card shadow="hover" class="box-card" @click.native="openDialog('repeat')">
  33. <div slot="header" class="clearfix">
  34. <span>重复回传设置</span>
  35. <el-button style="float: right; padding: 3px 0" type="text">设置</el-button>
  36. </div>
  37. <div class="card-content">
  38. <i class="el-icon-refresh card-icon"></i>
  39. <p class="card-desc">配置线索去重策略及回传过滤规则</p>
  40. </div>
  41. </el-card>
  42. </el-col>
  43. </el-row>
  44. <!-- 弹窗1: 站点重复报名设置 -->
  45. <el-dialog title="站点重复报名设置" :visible.sync="dialogs.duplicate" width="600px" append-to-body>
  46. <el-form ref="duplicateForm" :model="form.duplicateRegistrationSettings" label-width="120px">
  47. <el-form-item label="报名逻辑">
  48. <el-radio-group v-model="form.duplicateRegistrationSettings.signUpLogic">
  49. <el-radio :label="1">学员可正常报名</el-radio>
  50. <el-radio :label="2">学员不可重复报名</el-radio>
  51. </el-radio-group>
  52. </el-form-item>
  53. <el-form-item label="处理逻辑" v-if="form.duplicateRegistrationSettings.signUpLogic === 2">
  54. <div>
  55. 客户站点报名后的
  56. <el-input-number v-model="form.duplicateRegistrationSettings.day" :min="1" :max="9999" size="small" style="width: 100px; margin: 0 5px;" />
  57. 天内,不可重复报名相同项目站点
  58. </div>
  59. </el-form-item>
  60. </el-form>
  61. <div slot="footer" class="dialog-footer">
  62. <el-button type="primary" @click="submitConfig">确 定</el-button>
  63. <el-button @click="dialogs.duplicate = false">取 消</el-button>
  64. </div>
  65. </el-dialog>
  66. <!-- 弹窗2: 全局熟客设置 -->
  67. <el-dialog title="全局熟客设置" :visible.sync="dialogs.regular" width="650px" append-to-body>
  68. <el-form ref="regularForm" :model="form.regularCustomerSettings" label-width="200px">
  69. <el-form-item label="全局熟客开关">
  70. <el-switch
  71. v-model="form.regularCustomerSettings.repeatSwitch"
  72. :active-value="1"
  73. :inactive-value="2"
  74. active-text="开启"
  75. inactive-text="关闭">
  76. </el-switch>
  77. <div class="form-tip">开启后,客户“站点投放报名”或“在线客服留言”时,将分配当前名片跟进人的二维码。特殊的,站点投放配置个微群活码或客服码,则在此模式下无法实现全局熟客,将按照分配规则进行分配出码</div>
  78. </el-form-item>
  79. <el-form-item label="小程序/加粉站点熟客判断">
  80. <el-switch
  81. v-model="form.regularCustomerSettings.authSwitch"
  82. :active-value="1"
  83. :inactive-value="2"
  84. active-text="开启"
  85. inactive-text="关闭">
  86. </el-switch>
  87. <div class="form-tip">小程序表单站点/加粉类站点可支持在微信授权后,根据微信身份判断熟客</div>
  88. </el-form-item>
  89. </el-form>
  90. <div slot="footer" class="dialog-footer">
  91. <el-button type="primary" @click="submitConfig">确 定</el-button>
  92. <el-button @click="dialogs.regular = false">取 消</el-button>
  93. </div>
  94. </el-dialog>
  95. <!-- 弹窗3: 重复回传设置 -->
  96. <el-dialog title="重复回传设置" :visible.sync="dialogs.repeat" width="600px" append-to-body>
  97. <el-form ref="repeatForm" :model="form.repeatPostbackSettings" label-width="140px">
  98. <el-form-item label="重复回传过滤">
  99. <el-switch
  100. v-model="form.repeatPostbackSettings.filter"
  101. :active-value="1"
  102. :inactive-value="2"
  103. active-text="开启"
  104. inactive-text="关闭">
  105. </el-switch>
  106. <div class="form-tip">开启后,若投放站点获取的线索与系统中已有客户重复,系统将不针对该线索进行回传。</div>
  107. </el-form-item>
  108. <el-form-item label="过滤方式" v-if="form.repeatPostbackSettings.filter === 1">
  109. <el-radio-group v-model="form.repeatPostbackSettings.method">
  110. <el-radio :label="1">按行为过滤</el-radio>
  111. <el-radio :label="2">按手机号过滤</el-radio>
  112. </el-radio-group>
  113. <div class="form-tip" v-if="form.repeatPostbackSettings.method === 1">若同一个客户在不同站点,重复触发相同行为事件,则不会向广告商回传</div>
  114. <div class="form-tip" v-if="form.repeatPostbackSettings.method === 2">若同一个客户在不同站点,重复提交相同手机号,则不会向广告商回传</div>
  115. </el-form-item>
  116. </el-form>
  117. <div slot="footer" class="dialog-footer">
  118. <el-button type="primary" @click="submitConfig">确 定</el-button>
  119. <el-button @click="dialogs.repeat = false">取 消</el-button>
  120. </div>
  121. </el-dialog>
  122. </div>
  123. </template>
  124. <script>
  125. import { getConfigDetail, addOrUpdateConfig } from "@/api/adv/configuration";
  126. export default {
  127. name: "AdvConfiguration",
  128. data() {
  129. return {
  130. // 弹窗控制
  131. dialogs: {
  132. duplicate: false,
  133. regular: false,
  134. repeat: false
  135. },
  136. // 完整表单数据
  137. form: {
  138. duplicateRegistrationSettings: {
  139. signUpLogic: 1,
  140. day: undefined
  141. },
  142. regularCustomerSettings: {
  143. repeatSwitch: 2,
  144. authSwitch: 2
  145. },
  146. repeatPostbackSettings: {
  147. filter: 2,
  148. method: 1
  149. }
  150. }
  151. };
  152. },
  153. created() {
  154. this.getDetail();
  155. },
  156. methods: {
  157. /** 获取配置详情 */
  158. getDetail() {
  159. getConfigDetail().then(response => {
  160. if (response.data) {
  161. // 合并数据,防止后端返回null导致结构丢失
  162. const data = response.data;
  163. if (data.duplicateRegistrationSettings) {
  164. this.form.duplicateRegistrationSettings = { ...this.form.duplicateRegistrationSettings, ...data.duplicateRegistrationSettings };
  165. }
  166. if (data.regularCustomerSettings) {
  167. this.form.regularCustomerSettings = { ...this.form.regularCustomerSettings, ...data.regularCustomerSettings };
  168. }
  169. if (data.repeatPostbackSettings) {
  170. this.form.repeatPostbackSettings = { ...this.form.repeatPostbackSettings, ...data.repeatPostbackSettings };
  171. }
  172. }
  173. });
  174. },
  175. /** 打开弹窗 */
  176. openDialog(type) {
  177. if (this.dialogs.hasOwnProperty(type)) {
  178. this.dialogs[type] = true;
  179. }
  180. },
  181. /** 提交保存 */
  182. submitConfig() {
  183. const loading = this.$loading({
  184. lock: true,
  185. text: '保存中...',
  186. spinner: 'el-icon-loading',
  187. background: 'rgba(0, 0, 0, 0.7)'
  188. });
  189. addOrUpdateConfig(this.form).then(response => {
  190. loading.close();
  191. // 根据要求:返回1成功,0失败
  192. // 通常 axios拦截器已处理code!=200的情况,但这里根据描述 data=1 成功
  193. if (response.code === 200) {
  194. if (response.data === 1 || response.data === '1' || response.data === true) {
  195. this.$message.success("保存成功");
  196. this.dialogs.duplicate = false;
  197. this.dialogs.regular = false;
  198. this.dialogs.repeat = false;
  199. this.getDetail(); // 刷新数据
  200. } else {
  201. this.$message.error("保存失败");
  202. }
  203. } else {
  204. this.$message.error(response.msg || "保存失败");
  205. }
  206. }).catch(() => {
  207. loading.close();
  208. });
  209. }
  210. }
  211. };
  212. </script>
  213. <style scoped lang="scss">
  214. .app-container {
  215. padding: 20px;
  216. background-color: #f0f2f5;
  217. min-height: calc(100vh - 84px);
  218. }
  219. .box-card {
  220. cursor: pointer;
  221. height: 220px;
  222. transition: all 0.3s;
  223. &:hover {
  224. transform: translateY(-5px);
  225. box-shadow: 0 12px 20px rgba(0, 0, 0, 0.1);
  226. }
  227. .card-content {
  228. display: flex;
  229. flex-direction: column;
  230. align-items: center;
  231. justify-content: center;
  232. height: 120px;
  233. .card-icon {
  234. font-size: 48px;
  235. color: #409EFF;
  236. margin-bottom: 20px;
  237. }
  238. .card-desc {
  239. color: #909399;
  240. font-size: 14px;
  241. text-align: center;
  242. line-height: 1.5;
  243. padding: 0 10px;
  244. }
  245. }
  246. }
  247. .form-tip {
  248. font-size: 12px;
  249. color: #909399;
  250. line-height: 1.5;
  251. margin-top: 5px;
  252. }
  253. </style>