relation-base.blade.php 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855
  1. @extends('layouts.base')
  2. @section('title', '会员设置')
  3. @section('content')
  4. <link href="{{static_url('yunshop/css/total.css')}}" media="all" rel="stylesheet" type="text/css" />
  5. <!-- 引入样式 -->
  6. <!-- 引入组件库 -->
  7. <link rel="stylesheet" href="{{static_url('../resources/views/goods/assets/css/common.css?time='.time())}}">
  8. @include('public.admin.uploadMultimediaImg')
  9. <style scoped>
  10. /*上传图片 */
  11. .addImg-box {
  12. width: 700px;
  13. display: flex;
  14. flex-wrap: wrap;
  15. /* border: 1px solid red; */
  16. cursor: pointer;
  17. }
  18. /* 点击事件添加 */
  19. .addLevel {
  20. margin-left: 65px;
  21. }
  22. .el-icon-plus {
  23. margin-top: 28px;
  24. }
  25. .addImg-list {
  26. width: 250px;
  27. height: 130px;
  28. margin-right: 20px;
  29. margin-bottom: 20px;
  30. position: relative;
  31. }
  32. .select-price {
  33. margin-top: 20px;
  34. }
  35. /* 商品图片添加 */
  36. .add-price-img {
  37. width: 250px;
  38. height: 130px;
  39. text-align: center;
  40. line-height: 20px;
  41. cursor: pointer;
  42. position: relative;
  43. border: 1px solid #ccc;
  44. }
  45. .anew {
  46. width: 100%;
  47. color: whitesmoke;
  48. text-align: center;
  49. background: rgba(0, 0, 0, .5) !important;
  50. padding: 5px 0 5px 0;
  51. position: absolute;
  52. bottom: 0;
  53. }
  54. .cancel-box {
  55. width: 16px;
  56. height: 16px;
  57. background: black;
  58. position: absolute;
  59. top: -9px;
  60. right: -9px;
  61. border-radius: 50%;
  62. }
  63. .cancel {
  64. color: white;
  65. font-size: 17px;
  66. line-height: 19px;
  67. text-indent: 0px;
  68. position: relative;
  69. left: 2px;
  70. top: -10px;
  71. }
  72. .el-icon-plus:before {
  73. font-size: 35px;
  74. }
  75. .select-img {
  76. margin-left: 135px;
  77. }
  78. .el-form-item__label {
  79. font-weight: 600;
  80. }
  81. /* 多选框 */
  82. .checkLis_text {
  83. font-weight: 600;
  84. margin-right: 10px;
  85. }
  86. /* 文本 */
  87. .p_text {
  88. color: black;
  89. font-size: 12px;
  90. font-family: "微软雅黑";
  91. opacity: .9;
  92. }
  93. .select_text_box {
  94. width: 65%;
  95. color: black;
  96. text-align: left;
  97. opacity: .9;
  98. font-size: 12px;
  99. line-height: 20px;
  100. font-family: "微软雅黑";
  101. margin-left: 68px;
  102. margin-top: 20px;
  103. }
  104. .select_text_box>p:nth-child(1) {
  105. margin-bottom: 5px;
  106. }
  107. /* 提示文字居中 */
  108. .el-popper[x-placement^=top] {
  109. text-align: center;
  110. }
  111. .el-popover--plain {
  112. font-size: 10px;
  113. }
  114. .el-popper[x-placement^=top] {
  115. /* display: none; */
  116. }
  117. [v-cloak] {
  118. display: none;
  119. }
  120. .rectangle-txt {
  121. margin-top: 100px;
  122. color: black;
  123. font-weight: 600;
  124. opacity: .6;
  125. user-select: none;
  126. margin-left:15px;
  127. }
  128. .add-goods-box{display: flex;margin-left: 68px;align-items: center;justify-content: center;width: 120px;height: 120px;border: 1px dashed #ccc;}
  129. .img-box{width: 120px;height: 120px;position: relative;}
  130. .delete{position: absolute;right: 0;top: 0;width: 100%;height: 100%;background-color: rgba(0, 0, 0, .7);display: none;justify-content: center;align-items: center;}
  131. .img-box:hover .delete{display: flex;}
  132. .goods-info>img{width: 40px;height: 40px;}
  133. .el-table{height: 70vh;max-height: 700px;overflow-y: auto;}
  134. .goods-list .el-dialog {display: flex;flex-direction: column;margin: 0 !important;position: absolute;top: 50%;left: 50%;transform: translate(-50%, -50%);}
  135. .goods-list .el-dialog .el-dialog__body {flex: 1;overflow: auto;}
  136. </style>
  137. <div class="all">
  138. <div id="app" v-cloak>
  139. <!-- 头部 -->
  140. <div class="total-head">
  141. <el-form>
  142. <el-form-item>
  143. <div class="vue-title">
  144. <div class="vue-title-left"></div>
  145. <div class="vue-title-content">会员设置</div>
  146. </div>
  147. </el-form-item>
  148. <!-- 上传头像 -->
  149. <el-form-item class="select-img" label="Banner">
  150. <!-- 上传图片 -->
  151. <!--
  152. selNum 参数
  153. one 上传一张图片
  154. more 上传多张图片
  155. -->
  156. <!-- :class="[isUpLevel ? 'addLevel' : '' ]" -->
  157. <div v-show="isUpLevel">
  158. <!-- 上传图片 -->
  159. <div class="addImg-box">
  160. <div v-show="showimg" @click="uploadPictures('thumb',1,'1')" class="addImg-list">
  161. <div v-show="showimg" style="width:100%;height:100%">
  162. <img style="width:100%;height:100%" v-show="showimg" :src="image" alt="">
  163. </div>
  164. <div v-show="showimg" class="cancel-box"><i class="cancel" @click.stop="DeletePictures">×</i></div>
  165. <div v-show="showimg" class="anew">点击重新上传</div>
  166. </div>
  167. <div v-show="!showimg" class="add-price-img" @click="uploadPictures('thumb',1,'2')">
  168. <i class="el-icon-plus"></i>
  169. <div class="select-price">选择图片</div>
  170. </div>
  171. <span class="rectangle-txt">长方形图片</span>
  172. </div>
  173. <!-- 上传图片 -->
  174. <!--
  175. selNum 参数
  176. one 上传一张图片
  177. more 上传多张图片
  178. -->
  179. <upload-multimedia-img :upload-show="showSelectMaterialPopup" :type="materialType" :name="formFieldName" :sel-num="isSelNum" @replace="showSelectMaterialPopup = !showSelectMaterialPopup" @sure="selectedMaterial">
  180. </upload-multimedia-img>
  181. </div>
  182. </el-form-item>
  183. </el-form>
  184. </div>
  185. <!-- 内容 -->
  186. <div class="total-sect">
  187. <el-form>
  188. <el-form-item>
  189. <div class="vue-title">
  190. <div class="vue-title-left"></div>
  191. <div class="vue-title-content">通知设置</div>
  192. </div>
  193. </el-form-item>
  194. <!-- 推广客户 -->
  195. <el-form-item style="margin-left:100px" label="获得推广权限通知">
  196. <el-select clearable style="width:500px;margin-right:10px" v-model="putVal" filterable placeholder="请选择">
  197. <el-option v-for="item in putList" :key="item.id" :label="item.title" :value="item.id">
  198. </el-option>
  199. </el-select>
  200. <!-- 提示文字 -->
  201. <el-tooltip v-model="isPut_istop_tool" :manual="true" effect="dark" :content="isPut_title_tool" placement="top">
  202. <el-switch v-model="isPut" @click.native="isOpenWeChatTemp(isPut,1)" active-color="#29BA9C" inactive-color="#ccc">
  203. </el-switch>
  204. </el-tooltip>
  205. </el-form-item>
  206. <!-- 新增客户 -->
  207. <el-form-item style="margin-left:128px" label="新增客户通知">
  208. <el-select clearable style="width:500px;margin-right:10px" v-model="clientVal" filterable placeholder="请选择">
  209. <el-option v-for="item in clientList" :key="item.id" :label="item.title" :value="item.id">
  210. </el-option>
  211. </el-select>
  212. <el-tooltip v-model="isClient_istop_tool" :manual="true" effect="dark" :content="isClient_title_tool" placement="top">
  213. <el-switch v-model="isClient" @click.native="isOpenWeChatTemp(isClient,2)" active-color="#29BA9C" inactive-color="#ccc">
  214. </el-switch>
  215. </el-tooltip>
  216. </el-form-item>
  217. </el-form>
  218. </div>
  219. <div class="total-sect">
  220. <el-form>
  221. <!-- 会员设置 -->
  222. <el-form-item>
  223. <div class="vue-title">
  224. <div class="vue-title-left"></div>
  225. <div class="vue-title-content">会员关系</div>
  226. </div>
  227. </el-form-item>
  228. <el-form-item style="margin-left:60px" label="会员关系页面显示推荐人">
  229. <el-switch active-value="1" inactive-value="0" v-model="relation.refe" active-color="#29BA9C" inactive-color="#ccc"></el-switch>
  230. </el-form-item>
  231. <el-form-item style="margin-left:32px" label="会员关系页面显示推荐人上级">
  232. <el-switch active-value="1" inactive-value="0" v-model="relation.refe_boss" active-color="#29BA9C" inactive-color="#ccc"></el-switch>
  233. </el-form-item>
  234. <el-form-item style="margin-left:103px" label="推荐人电话微信号">
  235. <el-switch active-value="1" inactive-value="0" v-model="relation.refe_phone" active-color="#29BA9C" inactive-color="#ccc"></el-switch>
  236. </el-form-item>
  237. <el-form-item style="margin-left:135px" label="显示关系等级">
  238. <el-checkbox-group v-model="info">
  239. <el-checkbox label="1">
  240. <span class="checkLis_text">1级</span>
  241. <!-- :disabled="isDisabled('1级')" -->
  242. <el-input clearable style="width:300px" v-model="relation.oneEvel" placeholder="一级关系等级"></el-input>
  243. </el-checkbox><br>
  244. <el-checkbox label="2" style="margin-left: 96px; margin-top:10px">
  245. <span class="checkLis_text">2级</span>
  246. <el-input clearable v-model="relation.twoEvel" style="width:300px" placeholder="二级关系等级"></el-input>
  247. </el-checkbox>
  248. </el-checkbox-group>
  249. </el-form-item>
  250. <el-form-item style="margin-left:164px;" label="显示按钮">
  251. <el-checkbox-group style="line-height: 0; margin-top:10px" v-model="relation.nameInfo">
  252. <el-checkbox :label="'wechat'">微信</el-checkbox>
  253. <el-checkbox :label="'phone'">手机</el-checkbox>
  254. <el-checkbox :label="'realname'">姓名</el-checkbox>
  255. </el-checkbox-group>
  256. <div class="select_text_box">
  257. <p>勾选后,页面将显示下级微信、手机号,如果个人资料中没有填写微信和绑定手机号,将不显示图标 !</p>
  258. </div>
  259. </el-form-item>
  260. <el-form-item style="margin-left:164px;" label="统计商品">
  261. <el-radio-group v-model="relation.is_statistical_goods">
  262. <el-radio label="1">开启</el-radio>
  263. <el-radio label="0">关闭</el-radio>
  264. </el-radio-group>
  265. <div class="select_text_box" style="margin: 0 0 10px;line-height: 1;">开启后,前端会员中心-客户显示商品的购买数量(统计团队已完成订单的商品数量,包含自购)</div>
  266. <div style="display: flex;" v-if="relation.is_statistical_goods == 1">
  267. <div class="add-goods-box" @click="showGoodsList">
  268. <div style="text-align: center;line-height: 2;">
  269. <i class="el-icon-plus" style="font-size: 30px;color: #ccc;"></i>
  270. <div>添加商品</div>
  271. </div>
  272. </div>
  273. <div style="margin: 0 10px;display: flex;" v-for="(item,i) in relation.statistical_goods" :key="i">
  274. <div>
  275. <div class="img-box">
  276. <img :src="item.thumb_url" style="width: 100%;height: 100%;">
  277. <div class="delete">
  278. <i class="el-icon-delete" style="color: red;font-size: 20px;" @click="relation.statistical_goods.splice(i,1)"></i>
  279. </div>
  280. </div>
  281. <div class="select_text_box" style="margin: 0;width: 120px;overflow: hidden;text-overflow: ellipsis;display: -webkit-box;-webkit-line-clamp: 2;-webkit-box-orient: vertical;">
  282. [[item.title]]</div>
  283. </div>
  284. <div style="width: 260px;margin-left: 10px;">
  285. <el-input v-model="item.custom_name" placeholder="自定义名称"></el-input>
  286. <div style="line-height: 1.5;color: #8c8c8c;font-size: 12px;">自定义名称前端显示,默认为商品原来的名称</div>
  287. </div>
  288. </div>
  289. </div>
  290. </el-form-item>
  291. </el-form>
  292. </div>
  293. <div class="total-sect">
  294. <el-form>
  295. <el-form-item>
  296. <div class="vue-title">
  297. <div class="vue-title-left"></div>
  298. <div class="vue-title-content">关系链</div>
  299. </div>
  300. </el-form-item>
  301. <el-form-item style="margin-left:166px;" label="导入会员">
  302. <el-button type="primary" @click="btnImport">重置</el-button>
  303. <div class="select_text_box">
  304. <p>旧会员同步新关系链,如果不同步,除经销商团队业绩升级、统计团队业绩功能外,其他功能不影响使用。<br>
  305. 如会员数据量过大,建议关闭站点再导入
  306. </p>
  307. </div>
  308. </el-form-item>
  309. </el-form>
  310. </div>
  311. <div class="total-floo">
  312. <el-form>
  313. <el-form-item>
  314. <div class="vue-title">
  315. <div class="vue-title-left"></div>
  316. <div class="vue-title-content">会员合并</div>
  317. </div>
  318. </el-form-item>
  319. <el-form-item style="margin-left:165px;" label="会员合并">
  320. <el-radio-group style="margin-top:5px;" v-model="merge.allMergeRadio">
  321. <el-radio :label="1">全自动合并</el-radio>
  322. <el-radio :label="0">新会员自动合并</el-radio>
  323. </el-radio-group>
  324. <div class="select_text_box">
  325. <p>新会员自动合并:合并规则上,如果被合并的会员是新注册的会员,则自动合并;如果不是,在提示会员数据异常,请联系客服处理,由后台选择需要保留的会员ID。</p>
  326. <p>全自动合并:按照会员保留优先级保留会员,其他会员登录信息自动同步到对应的会员ID上,除保留的会员登录凭证外,其他被同步的会员数据 (订单、积分、余额、下级、佣金等)全部无法合并。</p>
  327. </div>
  328. </el-form-item>
  329. <el-form-item style="margin-left: 122px;" label="会员保留优先级">
  330. <el-radio-group style="margin-top:5px;" v-model="merge.priority">
  331. <el-radio :label="0">注册时间</el-radio>
  332. <el-radio :label="1">手机号</el-radio>
  333. <el-radio :label="2">公众号</el-radio>
  334. <el-radio :label="3">微信小程序</el-radio>
  335. <el-radio :label="4">APP微信登录</el-radio>
  336. <el-radio :label="5">支付宝登录</el-radio>
  337. </el-radio-group>
  338. <div class="select_text_box" style="margin-left:109px;">
  339. <p>会员合并时,保留所选优先级对应的会员ID,其他的会员登录平台将合并到该会员ID上;</p>
  340. <p> 如果不存在优先级设置的会员,则按注册时间优先合并。</p>
  341. </div>
  342. </el-form-item>
  343. </el-form>
  344. </div>
  345. <div class="fixed total-floo">
  346. <div class="fixed_box">
  347. <el-form>
  348. <el-form-item>
  349. <el-button type="primary" @click="submit">提交</el-button>
  350. </el-form-item>
  351. </el-form>
  352. </div>
  353. </div>
  354. <el-dialog width="60%" :visible.sync="showProgress" center :close-on-click-modal="false">
  355. <h3 style="">清除旧数据进度,请勿刷新当前页面</h3>
  356. <el-progress :percentage="del_process" ></el-progress>
  357. <h3 style="">同步新数据进度,请勿刷新当前页面</h3>
  358. <el-progress :percentage="process" ></el-progress>
  359. </el-dialog>
  360. <div class="goods-list">
  361. <el-dialog title="提示" :visible.sync="show" width="800px" class="aaa">
  362. <div style="display: flex;">
  363. <el-input v-model="keyword" placeholder="请输入关键字搜索" style="margin-right: 20px;"></el-input>
  364. <el-button type="primary" @click="getGoods">搜 索</el-button>
  365. </div>
  366. <el-table :data="tableData" style="width: 100%">
  367. <el-table-column prop="id" label="ID" width="180"></el-table-column>
  368. <el-table-column label="商品">
  369. <template slot-scope="scope">
  370. <div class="goods-info">
  371. <img :src="scope.row.thumb_url" alt="">
  372. <div class="tips goods-title">[[scope.row.title]]</div>
  373. </div>
  374. </template>
  375. </el-table-column>
  376. <el-table-column label="操作" width="100">
  377. <template slot-scope="scope">
  378. <el-button @click="handleClick(scope.row)" type="text" size="small">[[queryGoods(scope.row)?"已":""]]选择</el-button>
  379. </template>
  380. </el-table-column>
  381. </el-table>
  382. <el-pagination @current-change="getGoods" :current-page.sync="page" :page-size="per_page" layout="total, prev, pager, next" :total="total" bachground></el-pagination>
  383. </el-dialog>
  384. </div>
  385. </div>
  386. <script>
  387. const getGoods = "{!! yzWebFullUrl('goods.goods.get-search-goods-json') !!}";
  388. const vm = new Vue({
  389. el: "#app",
  390. name: "blade",
  391. // 防止后端冲突,修改ma语法符号
  392. delimiters: ['[[', ']]'],
  393. data() {
  394. return {
  395. tableData:[],
  396. show:false,
  397. keyword:"",
  398. total:0,
  399. page:0,
  400. per_page:0,
  401. info: [],
  402. // 上传图片
  403. showSelectMaterialPopup: false,
  404. materialType: "",
  405. formFieldName: "",
  406. goodsIdList: "",
  407. //当前图片状态
  408. image: "",
  409. showimg: false,
  410. index: null,
  411. isSelNum: "one",
  412. isUpLevel: true,
  413. putList: [],
  414. clientList: [],
  415. putVal: "",
  416. clientVal: "",
  417. isPut: false,
  418. isClient: false,
  419. showProgress: false,
  420. del_process: 0,
  421. process: 0,
  422. //微信模板
  423. weChatTemp: "",
  424. //会员关系
  425. relation: {
  426. refe: "1",
  427. refe_boss: "1",
  428. refe_phone: "1",
  429. refe_checkList: [],
  430. oneEvel: "",
  431. twoEvel: "",
  432. nameInfo: [],
  433. is_statistical_goods:"0",
  434. statistical_goods:[]
  435. },
  436. //会员合并
  437. merge: {
  438. allMergeRadio: 0,
  439. priority: 0
  440. },
  441. //显示的状态
  442. isPut_istop_tool: false,
  443. //显示的文字
  444. isPut_title_tool: "",
  445. //显示的状态
  446. isClient_istop_tool: false,
  447. //显示的文字
  448. isClient_title_tool: "",
  449. //保存多选数据
  450. checkboxLevel: [],
  451. //开启微信多选数据
  452. checkboxBtn: []
  453. }
  454. },
  455. created() {
  456. //优化在不同设备固定定位挡住的现象设置父元素的内边距
  457. window.onload = function() {
  458. let all = document.querySelector(".all");
  459. let h = window.innerHeight * 0.03;
  460. all.style.paddingBottom = h + "px";
  461. }
  462. this.postRelation();
  463. },
  464. methods: {
  465. loading(text) {
  466. return this.$loading({
  467. lock: true,
  468. text: text,
  469. spinner: 'el-icon-loading',
  470. background: 'rgba(0, 0, 0, 0.7)'
  471. });
  472. },
  473. showGoodsList() {
  474. if (!this.tableData || this.tableData.length <= 0) this.getGoods();
  475. this.show = true;
  476. },
  477. getGoods() {
  478. let loading = this.loading("正在获取数据中...");
  479. this.$http.post(getGoods, {keyword: this.keyword, page: this.page}).then(({data: {result,msg,data: {goods}}}) => {
  480. loading.close();
  481. if (result == 1) {
  482. this.tableData = goods.data;
  483. this.total = goods.total;
  484. this.per_page = goods.per_page;
  485. } else this.$message.error(msg);
  486. })
  487. },
  488. queryGoods(row){
  489. let statistical_goods = this.relation.statistical_goods;
  490. if(!statistical_goods) return false;
  491. for(let i = 0;i<statistical_goods.length;i++){
  492. if(statistical_goods[i].id == row.id) return true;
  493. }
  494. return false;
  495. },
  496. handleClick(row){
  497. if(this.queryGoods(row)) return this.$message.error("已经选择此商品");
  498. if(!this.relation.statistical_goods) this.relation.statistical_goods = [];
  499. if ( this.relation.statistical_goods.length >=2) return this.$message.error("最多只能选择两件商品");
  500. this.relation.statistical_goods.push(row);
  501. },
  502. //请求回显网络数据
  503. postRelation() {
  504. this.$http.post("{!!yzWebFullUrl('member.member-relation.relation-base')!!}", {}).then(res => {
  505. console.log(res.body.data);
  506. let {
  507. banner,
  508. temp_list: list,
  509. member_relation,
  510. member_merge,
  511. notice
  512. } = res.body.data;
  513. //banner 选择图片
  514. if (banner!==null && banner) {
  515. //显示图片
  516. this.showimg = true;
  517. this.image = banner
  518. }
  519. if(list!==null && list){
  520. //获得推广权限通知列表
  521. list.unshift({
  522. id: 0,
  523. title: '默认消息模板'
  524. })
  525. this.putList = list;
  526. this.clientList = list;
  527. }
  528. if(member_relation!==null){
  529. //会员关系显示推荐人 is_referrer
  530. this.relation.refe = member_relation.is_referrer;
  531. //会员关系显示推荐人上级 parent_is_referrer
  532. this.relation.refe_boss =member_relation.parent_is_referrer;
  533. // console.log(this.relation.refe_boss,4545153);
  534. // 推荐人电话微信号 is_recommend_wechat
  535. this.relation.refe_phone = member_relation.is_recommend_wechat;
  536. // console.log(base.relation_level);
  537. //一级关系等级保存多选
  538. if (member_relation.one_level == 1 ) {
  539. this.info.push('1')
  540. }
  541. if (member_relation.two_level == 2) {
  542. this.info.push('2')
  543. }
  544. if (member_relation.phone == 1) {
  545. this.relation.nameInfo.push('phone')
  546. }
  547. if (member_relation.realname == 1) {
  548. this.relation.nameInfo.push('realname')
  549. }
  550. if (member_relation.wechat == 1) {
  551. this.relation.nameInfo.push('wechat')
  552. }
  553. //一级关系等级自定义
  554. this.relation.oneEvel = member_relation.name1
  555. //二级关系等级自定义
  556. this.relation.twoEvel =member_relation.name2
  557. this.relation.statistical_goods = member_relation.statistical_goods;
  558. this.relation.is_statistical_goods = member_relation.is_statistical_goods?member_relation.is_statistical_goods:"0";
  559. }
  560. if(notice!==null && notice){
  561. if(notice.member_agent) {
  562. this.postRelationID(notice.member_agent, 1)
  563. }else {
  564. this.putVal = 0;
  565. }
  566. if(notice.member_new_lower) {
  567. this.postRelationID(notice.member_new_lower, 2)
  568. }else {
  569. this.clientVal = 0;
  570. }
  571. }
  572. //全自动合并 is_member_merge
  573. if(member_merge!==null && member_merge){
  574. this.merge.allMergeRadio = Number(member_merge.is_member_merge);
  575. //会员保留优先级 is_merge_save_level
  576. this.merge.priority = Number(member_merge.is_merge_save_level);
  577. }
  578. })
  579. },
  580. //上传图片
  581. uploadPictures(fieldName, type, i) {
  582. this.formFieldName = fieldName;
  583. this.showSelectMaterialPopup = !this.showSelectMaterialPopup;
  584. this.materialType = String(type);
  585. this.index = i;
  586. },
  587. selectedMaterial(name, image, imageUrl) {
  588. this.showimg = image;
  589. //判断是否为点击添加
  590. if (this.index == '2') {
  591. this.image = imageUrl[0].url;
  592. this.goodsIdList = imageUrl[0].id;
  593. } else {
  594. // console.log(11);
  595. this.image = imageUrl[0].url;
  596. }
  597. },
  598. //点击删除当前图片
  599. DeletePictures() {
  600. //删除当前的图片
  601. this.image = "";
  602. this.showimg = false;
  603. },
  604. //请求id 是否开启默认模板
  605. isOpenWeChatTemp(isVal, id) {
  606. // console.log(isVal, id)
  607. var postdata ={
  608. notice_name: '',
  609. setting_name: "relation_base"
  610. }
  611. var url = "";
  612. if (id === 1) {
  613. //推广客户
  614. postdata.notice_name = 'member_agent';
  615. }else if (id === 2) {
  616. //新增客户
  617. postdata.notice_name = 'member_new_lower';
  618. }
  619. if(!isVal) {
  620. url = "{!!yzWebFullUrl('setting.default-notice.cancel')!!}";
  621. }else {
  622. url = "{!!yzWebFullUrl('setting.default-notice.index')!!}";
  623. }
  624. this.$http.post(url, postdata).then(res => {
  625. // console.log(res)
  626. if (id === 1) {
  627. if(!this.isPut) {
  628. this.isPut_istop_tool = true;
  629. this.isPut_title_tool = "关闭成功";
  630. setTimeout(() => {
  631. this.isPut_istop_tool = false;
  632. }, 2000)
  633. }else {
  634. this.isPut_istop_tool = true;
  635. if(res.body.result == 1) {
  636. this.isPut_title_tool = "开启成功";
  637. this.isPut = true;
  638. setTimeout(() => {
  639. this.isPut_istop_tool = false;
  640. }, 2000)
  641. }else {
  642. this.isPut_title_tool = "开启失败,请检查微信模板";
  643. this.isPut = false;
  644. setTimeout(() => {
  645. this.isPut_istop_tool = false;
  646. }, 2000)
  647. }
  648. }
  649. }else {
  650. if(!this.isClient) {
  651. this.isClient_istop_tool = true;
  652. this.isClient_title_tool = "关闭成功";
  653. setTimeout(() => {
  654. this.isClient_istop_tool = false;
  655. }, 2000)
  656. }else {
  657. this.isClient_istop_tool = true;
  658. if(res.body.result == 1) {
  659. this.isClient_title_tool = "开启成功";
  660. this.isClient = true;
  661. setTimeout(() => {
  662. this.isClient_istop_tool = false;
  663. }, 2000)
  664. }else {
  665. this.isClient_title_tool = "开启失败,请检查微信模板";
  666. this.isClient = false;
  667. setTimeout(() => {
  668. this.isClient_istop_tool = false;
  669. }, 2000)
  670. }
  671. }
  672. }
  673. })
  674. },
  675. //检查是否开启默认模板
  676. postRelationID(id, i) {
  677. this.$http.post("{!!yzWebFullUrl('member.member-relation.get-is-default-by-id')!!}", {
  678. id: id
  679. }).then(res => {
  680. // console.log(res)
  681. if(res.body.result != 1) {
  682. // result=0的情况
  683. if (i == 1) {
  684. this.isPut = false;
  685. this.putVal = Number(id) || 0;
  686. } else {
  687. this.isClient = false;
  688. this.clientVal = Number(id) || 0;
  689. }
  690. return;
  691. }else {
  692. if (i == 1) {
  693. this.isPut = res.body.data.data;
  694. if(this.isPut) {
  695. this.putList.map((item=> {
  696. if(item.title == '默认消息模板') {
  697. item.id = Number(id)
  698. }
  699. }))
  700. this.putList.reverse().reverse();
  701. }
  702. this.putVal = Number(id);
  703. } else {
  704. this.isClient = res.body.data.data;
  705. if(this.isClient) {
  706. this.clientList.map((item=> {
  707. if(item.title == '默认消息模板') {
  708. item.id = Number(id)
  709. }
  710. }))
  711. this.clientList.reverse().reverse();
  712. }
  713. this.clientVal = Number(id);
  714. }
  715. }
  716. })
  717. },
  718. //导入
  719. btnImport() {
  720. this.count = 0;
  721. this.process = 0;
  722. this.showProgress = true;
  723. this.$http.post("{!! yzWebFullUrl('member.member.exportRelation') !!}",{})
  724. .then(response => {
  725. if (response.data.result) {
  726. this.process = parseInt(response.data.data.process);
  727. this.del_process = parseInt(response.data.data.del_process);
  728. this.loop(
  729. response.data.data.page,
  730. response.data.data.del_page,
  731. response.data.data.del_total,
  732. response.data.data.max_parent_id,
  733. response.data.data.max_child_id,
  734. response.data.data.max_member_id);
  735. } else {
  736. this.$message({message: response.data.msg,type: 'error'});
  737. }
  738. },response => {
  739. });
  740. },
  741. loop (page,del_page,del_total,max_parent_id,max_child_id,max_member_id) {
  742. this.$http.post("{!! yzWebFullUrl('member.member.exportRelation') !!}",{
  743. page:page,
  744. del_page:del_page,
  745. del_total:del_total,
  746. max_parent_id:max_parent_id,
  747. max_child_id:max_child_id,
  748. max_member_id:max_member_id
  749. })
  750. .then(response => {
  751. if (response.data.result) {
  752. if (!this.showProgress) {
  753. this.$message({type: 'error',message: '终止同步!'});
  754. return;
  755. }
  756. if (response.data.data) {
  757. this.process = parseInt(response.data.data.process);
  758. this.del_process = parseInt(response.data.data.del_process);
  759. }
  760. if (response.data.data.status == true) {
  761. this.showProgress = false;
  762. this.$message({type: 'success',message: '同步成功!'});
  763. } else {
  764. this.loop( response.data.data.page,
  765. response.data.data.del_page,
  766. response.data.data.del_total,
  767. response.data.data.max_parent_id,
  768. response.data.data.max_child_id,
  769. response.data.data.max_member_id);
  770. }
  771. } else {
  772. this.$message({type: 'error',message: response.data.msg});
  773. this.showProgress = false;
  774. }
  775. },response => {
  776. this.$message({type: 'error',message: response.data.msg});
  777. this.showProgress = false;
  778. });
  779. },
  780. //提交保存
  781. submit() {
  782. let statistical_goods = this.relation.statistical_goods;
  783. if(statistical_goods&&statistical_goods.length>0){
  784. var goods = {statistical_goods}
  785. }
  786. this.$http.post("{!!yzWebFullUrl('member.member-relation.relation-base')!!}", {
  787. base: {
  788. ...goods,
  789. is_statistical_goods:this.relation.is_statistical_goods,
  790. banner: this.image,
  791. member_agent: this.putVal,
  792. member_new_lower: this.clientVal,
  793. is_referrer: this.relation.refe,
  794. parent_is_referrer: this.relation.refe_boss,
  795. is_recommend_wechat: this.relation.refe_phone,
  796. relation_level: {
  797. "0": this.info.indexOf('1') > -1 ? 1 : 0,
  798. "1": this.info.indexOf('2') > -1 ? 2 : 0,
  799. "name1": this.relation.oneEvel,
  800. "name2": this.relation.twoEvel,
  801. "wechat": this.relation.nameInfo.indexOf('wechat') > -1 ? 1 : 0,
  802. "phone": this.relation.nameInfo.indexOf('phone') > -1 ? 1 : 0,
  803. "realname": this.relation.nameInfo.indexOf('realname') > -1 ? 1 : 0,
  804. },
  805. is_member_merge: this.merge.allMergeRadio,
  806. is_merge_save_level: this.merge.priority
  807. }
  808. }).then((res) => {
  809. console.log(res, 123);
  810. if (res.data.result === 1) {
  811. this.$message.success(res.data.msg)
  812. //成功刷新页面
  813. history.go(0);
  814. } else {
  815. this.$message.error(res.data.msg)
  816. }
  817. })
  818. }
  819. }
  820. })
  821. </script>@endsection