relation.blade.php 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852
  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. <link rel="stylesheet" href="{{static_url('css/public-number.css')}}">
  6. <style>
  7. .el-checkbox__label {
  8. line-height: 40px;
  9. }
  10. /* 提示文本 */
  11. .text-des {
  12. margin-left: 0px;
  13. }
  14. .text {
  15. color: #999;
  16. font-variant: small-caps;
  17. font-weight: 400;
  18. font-size: 12px;
  19. font-family: arial, verdana;
  20. }
  21. .text-des-jur,
  22. .text-des {
  23. color: #999;
  24. line-height: 20px;
  25. }
  26. /* 选择框修改边框颜色 */
  27. .el-radio__inner,
  28. .el-checkbox__inner {
  29. border: 1px solid #999;
  30. }
  31. /* 提示头文本 */
  32. .el-form-item__content {
  33. /* border: 1px solid red; */
  34. line-height: 40px !important;
  35. }
  36. .el-form-item__label,
  37. .el-radio {
  38. font-weight: 600;
  39. }
  40. /* 上传商品图片列表 */
  41. .el-upload-list--picture-card .el-upload-list__item {
  42. width: 110px;
  43. height: 110px;
  44. margin-right: 20px;
  45. }
  46. .el-upload--picture-card:hover .el-icon-plus {
  47. color: #29BA9C;
  48. }
  49. .el-upload--picture-card {
  50. width: 110px;
  51. height: 110px;
  52. line-height: 100px;
  53. position: relative;
  54. overflow: hidden;
  55. }
  56. .upload-text {
  57. display: block;
  58. line-height: 0;
  59. margin-top: 28px;
  60. position: absolute;
  61. top: 50%;
  62. left: 50%;
  63. transform: translate(-50%, -50%);
  64. }
  65. .des-text {
  66. margin-top: 10px;
  67. }
  68. .vue-upload {
  69. width: 556.5px;
  70. margin-left: 162px;
  71. }
  72. .el-form-item__content {
  73. line-height: 20px;
  74. font-size: 13px;
  75. }
  76. /* 上传商品部分*/
  77. .addLevel {
  78. margin-left: 65px;
  79. }
  80. /*上传图片 */
  81. .addImg-box {
  82. width: 700px;
  83. display: flex;
  84. flex-wrap: wrap;
  85. cursor: pointer;
  86. }
  87. .addImg-list {
  88. height: 150px;
  89. width: 150px;
  90. margin-right: 20px;
  91. margin-bottom: 60px;
  92. position: relative;
  93. }
  94. .cancel-box {
  95. width: 16px;
  96. height: 16px;
  97. user-select: none;
  98. background: black;
  99. position: absolute;
  100. top: -9px;
  101. right: -9px;
  102. border-radius: 50%;
  103. }
  104. .cancel {
  105. color: white;
  106. font-size: 18px;
  107. line-height: 19px;
  108. text-indent: 0px;
  109. position: relative;
  110. left: 2px;
  111. top: -10px;
  112. }
  113. .anew {
  114. width: 100%;
  115. color: whitesmoke;
  116. text-align: center;
  117. font-size: 13px !important;
  118. font-weight: 400;
  119. padding: 5px 0 5px 0;
  120. position: absolute;
  121. bottom: 0;
  122. background: rgba(0, 0, 0, .5) !important;
  123. }
  124. /* 商品图片添加 */
  125. .add-price-img {
  126. height: 150px;
  127. width: 150px;
  128. text-align: center;
  129. line-height: 20px;
  130. cursor: pointer;
  131. position: relative;
  132. border: 1px solid #ccc;
  133. }
  134. .el-icon-plus {
  135. font-size: 40px;
  136. margin-top: 45px;
  137. }
  138. .select-price {
  139. font-size: 13px;
  140. margin-top: 15px;
  141. }
  142. .cell {
  143. text-align: center;
  144. }
  145. .el-checkbox-group {
  146. font-size: 1px;
  147. }
  148. /* 优化显示效果 */
  149. [v-cloak] {
  150. display: none;
  151. }
  152. /* 文字溢出隐藏 */
  153. .middenTitle {
  154. width: 100%;
  155. font-size: 12px;
  156. white-space: normal;
  157. text-overflow: -o-ellipsis-lastline;
  158. overflow: hidden;
  159. text-overflow:
  160. ellipsis;
  161. display: -webkit-box;
  162. -webkit-line-clamp: 2;
  163. line-clamp: 2;
  164. -webkit-box-orient: vertical;
  165. line-height: 20px;
  166. text-indent: -6px;
  167. margin-top: 6px;
  168. }
  169. </style>
  170. <div class="all">
  171. <div id="app" v-cloak>
  172. <!-- 关系设置 -->
  173. <div class="total-head">
  174. <div class="vue-title">
  175. <div class="vue-title-left"></div>
  176. <div class="vue-title-content">关系设置</div>
  177. </div>
  178. <el-form label-width="300px">
  179. <el-form-item label="启用关系链">
  180. <el-switch active-value="1" inactive-value="0" v-model="setdata.status" active-color="#29BA9C" inactive-color="#ccc">
  181. </el-switch>
  182. <div class="text-des-jur text">开启后首页也需要授权登录</div>
  183. </el-form-item>
  184. <el-form-item label="获得推广权益的条件">
  185. <el-radio-group v-model="setdata.become">
  186. <div style="margin-top:10px;">
  187. <el-radio :label="0">无条件</el-radio>
  188. </div>
  189. <div style="margin:10px 0;">
  190. <el-radio :label="1">申请</el-radio>
  191. </div>
  192. <el-radio :label="2">或</el-radio>
  193. <el-radio :label="3">与</el-radio>
  194. <div class="text-des text">[或]满足以下任意条件都可以成为推广员</div>
  195. <div class="text-des text">[与]满足以下所有条件才可以成为推广员</div>
  196. </el-radio-group>
  197. </el-form-item>
  198. <!-- 控制显示隐藏块 -->
  199. <div v-show="isTermShow">
  200. <el-form-item>
  201. <el-checkbox-group v-model="setdata.become_term">
  202. <el-checkbox :label="2">
  203. 消费达到 &nbsp;<el-input clearable v-model="setdata.become_ordercount" style="width:100%">
  204. <template slot="append">次</template>
  205. </el-input>
  206. </el-checkbox></br>
  207. <el-checkbox :label="3">
  208. 消费达到 &nbsp;<el-input clearable v-model="setdata.become_moneycount" style="width:100%">
  209. <template slot="append">元</template>
  210. </el-input>
  211. </el-checkbox>
  212. <div>
  213. <el-checkbox :label="4">购买商品</el-checkbox>
  214. </div>
  215. <!-- 上传商品部分 -->
  216. <div>
  217. <div v-show="isUpLevel">
  218. <!-- 上传商品 -->
  219. <div class="addImg-box">
  220. <div class="addImg-list" v-for="(itemImg,i) in image" :key="i" @click="uploadingGoods(0,i)">
  221. <div class="itemImg_box">
  222. <img style="width:150px;height:150px" :src="itemImg" alt="">
  223. <div class="middenTitle">【ID:[[ goodsIdList[i] ]]】[[ commodity_title[i] ]]</div>
  224. </div>
  225. <div class="cancel-box" @click.stop="cancel(i)"><i class="cancel">×</i></div>
  226. <div class="anew">点击重新上传</div>
  227. </div>
  228. <div @click.stop="uploadingGoods(1)" class="add-price-img">
  229. <i class="el-icon-plus"></i>
  230. <div class="select-price">选择商品</div>
  231. </div>
  232. </div>
  233. <p class="text">可指定多件商品,只需购买其中一件就可以成为推广员</p>
  234. <el-dialog width="55%" center title="选择商品" :visible.sync="isUploadingGoos">
  235. <el-input clearable v-model="seekInput" placeholder="搜索商品名称" style="width:80%;margin-right:25px"></el-input>
  236. <el-button @click="seekBtn(1)" @keyup.enter="seekBtn" type="primary">搜索</el-button>
  237. <el-table ref="singleTable" v-loading="loading" height="400" :data="gridData">
  238. <el-table-column property="id" label="ID"></el-table-column>
  239. <el-table-column label="商品信息">
  240. <template slot-scope="scope">
  241. <img style="width:30px;height:30px;margin-right:5px" v-if="scope.row.thumb!==null && scope.row.thumb" :src="scope.row.thumb">
  242. <span>[[scope.row.title]]</span>
  243. </template>
  244. </el-table-column>
  245. <el-table-column label="操作">
  246. <template slot-scope="scope">
  247. <el-button @click="addGoods(scope.row,scope.$index)">操作</el-button>
  248. </template>
  249. </el-table-column>
  250. </el-table>
  251. <div style="margin-top:50px">
  252. [[currentPage]]
  253. <el-pagination layout="prev, pager, next,jumper" background style="text-align:center" :page-size="pagesize" :current-page="currentPage" :total="total" @current-change="handleCurrentChange">
  254. </el-pagination>
  255. </div>
  256. </el-dialog>
  257. </div>
  258. <div v-if="is_sales_commission == 1">
  259. <el-checkbox :label="5" style="margin-top:10px">
  260. 自购销售佣金累计达到 &nbsp;
  261. <el-input clearable v-model="setdata.become_commission" style="width:400px;"><template slot="append">元</template></el-input>
  262. </el-checkbox>
  263. <div style="margin-left:176px;">该条件只针对销售佣金插件使用</div>
  264. </div>
  265. </el-checkbox-group>
  266. </el-form-item>
  267. <el-form-item style=" width:600px;">
  268. <el-radio-group v-model="setdata.payment">
  269. <el-radio :label="0">付款后</el-radio>
  270. <el-radio :label="1">完成后</el-radio>
  271. </el-radio-group>
  272. <div class="text">消费条件统计的方式</div>
  273. </el-form-item>
  274. </div>
  275. </div>
  276. <el-form-item label="锁定客户的标准">
  277. <el-radio-group v-model="setdata.firstOrder">
  278. <el-radio :label="0">点击首次分享链接</el-radio>
  279. <el-radio :label="1">首次下单</el-radio>
  280. <el-radio :label="2">首次付款</el-radio>
  281. </el-radio-group>
  282. <div class="text">首次下单/首次付款:无条件不可用</div>
  283. </el-form-item>
  284. <el-form-item label="是否需要审核才能推广">
  285. <el-radio-group v-model="setdata.rights">
  286. <el-radio :label="1">需要</el-radio>
  287. <el-radio :label="0">不需要</el-radio>
  288. </el-radio-group>
  289. <div class="text">以上条件达到后,是否需要审核才能推广客户</div>
  290. </el-form-item>
  291. </el-form>
  292. </div>
  293. <!-- 奖励设置 -->
  294. <div class="total-sect">
  295. <el-form label-width="300px">
  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 label="推荐一个人奖励积分">
  301. <el-input clearable v-model="reward.integral" style="width:360px;"></el-input>
  302. <div class="text">提示:只奖励给第一次锁定的上级会员</div>
  303. </el-form-item>
  304. <el-form-item label="赠送积分最大人数">
  305. <el-input clearable v-model="reward.integral_people" style="width:360px;"></el-input>
  306. <div class="text">不填或为0则不限制</div>
  307. </el-form-item>
  308. </el-form>
  309. </div>
  310. <!-- 页面设置 -->
  311. <div class="total-floo">
  312. <el-form label-width="300px">
  313. <div class="vue-title">
  314. <div class="vue-title-left"></div>
  315. <div class="vue-title-content">页面设置</div>
  316. </div>
  317. <el-form-item label="推广中心跳转">
  318. <el-switch active-value="1" inactive-value="0" v-model="page.promotion_skip" active-color="#29BA9C" inactive-color="#ccc" />
  319. </el-form-item>
  320. <div v-show="isSkipShow">
  321. <el-form-item label="链接">
  322. <div>
  323. <el-input clearable v-model="page.link" style="width:50%;margin-right:5px;"></el-input>
  324. <el-button @click="showLink('link','link_two')">选择链接</el-button>
  325. <div class="text">当会员没有获得推广资格的时候,点击推广中心跳转到指定的页面的,默认进入推广中心</div>
  326. </div>
  327. </el-form-item>
  328. <el-form-item label="小程序链接">
  329. <div>
  330. <el-input clearable v-model="page.applet_link" style="width:50%;margin-right:5px;"></el-input>
  331. <el-button @click="showLink('mini','min_link_two')">选择小程序链接</el-button>
  332. </div>
  333. </el-form-item>
  334. </div>
  335. <el-form-item label="我的收入页面">
  336. <el-switch active-value="1" inactive-value="0" v-model="page.income_page" active-color="#29BA9C" inactive-color="#ccc" />
  337. </el-form-item>
  338. <el-form-item label="收入明细购买者信息">
  339. <el-switch active-value="1" inactive-value="0" v-model="page.buyer_info" active-color="#29BA9C" inactive-color="#ccc" />
  340. </el-form-item>
  341. <pop :show="show" @replace="changeLink" @add="parHref"></pop>
  342. <program :pro="pro" @replacepro="changeprogram" @addpro="parpro"></program>
  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" size="default">提交</el-button>
  350. </el-form-item>
  351. </el-form>
  352. </div>
  353. </div>
  354. </div>
  355. @include('public.admin.pop')
  356. @include('public.admin.program')
  357. <script>
  358. var vm = new Vue({
  359. el: '#app',
  360. delimiters: ['[[', ']]'],
  361. data() {
  362. return {
  363. show: false, //是否开启公众号弹窗
  364. pro: false, //是否开启小程序弹窗
  365. //关系设置
  366. setdata: {
  367. status: "0",
  368. become: 0,
  369. become_term: [],
  370. become_ordercount: "",
  371. become_moneycount: "",
  372. become_commission: "",
  373. become_goods_id: "0",
  374. become_goods: "0",
  375. //单选按钮
  376. payment: 1,
  377. firstOrder: 0,
  378. rights: 1,
  379. },
  380. //奖励设置
  381. reward: {
  382. integral: "",
  383. integral_people: 30
  384. },
  385. //页面设置
  386. page: {
  387. promotion_skip: 0,
  388. link: "",
  389. applet_link: "",
  390. income_page: 0,
  391. buyer_info: 0
  392. },
  393. //判断显示隐藏
  394. isShow: false,
  395. //上传商品
  396. isUpLevel: true,
  397. //上传商品
  398. isUploadingGoos: false,
  399. //商品
  400. //当前图片状态
  401. image: [],
  402. commodity_title: [],
  403. //商品的id
  404. goodsIdList: [],
  405. showimg: true,
  406. //接收的id
  407. id: "",
  408. //判断点击的东西
  409. isIndex: 1,
  410. //点击当前的图片index
  411. indexImg: 0,
  412. //判断是否有isCreated
  413. isCreated: false,
  414. //商品列表
  415. gridData: [],
  416. //页码数
  417. currentPage: 1,
  418. //一页显示数据
  419. pagesize: 1,
  420. //总页数
  421. total: 1,
  422. //当前响应的图标
  423. loading: true,
  424. isi: false,
  425. //搜索
  426. seekInput: "",
  427. isEvent: true,
  428. //判断自购插件是否开启
  429. is_sales_commission: 0,
  430. }
  431. },
  432. created() {
  433. g = this;
  434. //优化在不同设备固定定位挡住的现象设置父元素的内边距
  435. window.onload = function() {
  436. let all = document.querySelector(".all");
  437. let h = window.innerHeight * 0.03;
  438. all.style.paddingBottom = h + "px";
  439. }
  440. //当前请求的网络数据
  441. this.postRelation();
  442. //全局监听searchBtnt enter事件
  443. document.onkeydown = (e) => {
  444. let key = window.event.keyCode;
  445. if (key == 13) {
  446. g.seekBtn(1);
  447. }
  448. }
  449. },
  450. watch: {
  451. "setdata.become_term"(newVal) {
  452. console.log(newVal);
  453. //关闭点击事件
  454. this.isEvent = true
  455. newVal.forEach(item => {
  456. if (item === 4) {
  457. //打开点击事件
  458. this.isEvent = false
  459. }
  460. })
  461. },
  462. "gridData": {
  463. handler() {
  464. // console.log(this.$refs);
  465. if (this.$refs.singleTable) {
  466. this.$nextTick(() => {
  467. this.$refs.singleTable.doLayout(); // 解决表格错位
  468. })
  469. }
  470. },
  471. deep: true
  472. }
  473. },
  474. computed: {
  475. //判断支付佣金部分显示隐藏
  476. isTermShow() {
  477. if (this.setdata.become === 2 || this.setdata.become === 3) {
  478. this.isShow = true
  479. } else {
  480. this.isShow = false
  481. }
  482. return this.isShow
  483. },
  484. //判断跳转部分显示隐藏
  485. isSkipShow() {
  486. if (this.page.promotion_skip == "0") {
  487. return false
  488. } else {
  489. return true
  490. }
  491. }
  492. },
  493. methods: {
  494. //请求数据
  495. postRelation() {
  496. this.$http.post("{!!yzWebFullUrl('member.member-relation.show')!!}").then(res => {
  497. let {
  498. relationship,
  499. reward,
  500. page
  501. } = res.body.data;
  502. let {
  503. is_sales_commission,
  504. status,
  505. become,
  506. become_term2,
  507. become_term3,
  508. become_term4,
  509. become_term5,
  510. goods,
  511. become_ordercount,
  512. become_moneycount,
  513. become_selfmoney,
  514. become_order,
  515. become_child,
  516. become_check,
  517. } = relationship;
  518. console.log(res);
  519. console.log(relationship);
  520. if (this.isObject(relationship)) {
  521. //插件开关
  522. // console.log(sales,45456);
  523. this.is_sales_commission = is_sales_commission;
  524. //启用关系链
  525. this.setdata.status = String(status);
  526. //推广条件
  527. this.setdata.become = become;
  528. let become_term = {
  529. become_term2,
  530. become_term3,
  531. become_term4,
  532. become_term5
  533. }
  534. console.log(become_term, 999894);
  535. //消费条件
  536. this.setdata.become_term = [];
  537. for (let item in become_term) {
  538. if (become_term[item] !== "") {
  539. this.setdata.become_term.push(Number(become_term[item]));
  540. }
  541. this.isEvent = false;
  542. // console.log(become_term[item] == "4",45456);
  543. if (become_term[item] == "4") {
  544. if (goods !== null && goods.length !== 0) {
  545. for (let i in goods) {
  546. // 购买商品
  547. if (goods[i].thumb) {
  548. this.image.push(goods[i].thumb);
  549. }
  550. if (goods[i].title) {
  551. this.commodity_title.push(goods[i].title);
  552. }
  553. if (goods[i].id) {
  554. this.goodsIdList.push(goods[i].id);
  555. }
  556. }
  557. }
  558. }
  559. }
  560. //消费达到多少次
  561. this.setdata.become_ordercount = become_ordercount;
  562. //消费达到多少元
  563. this.setdata.become_moneycount = become_moneycount;
  564. //自购
  565. this.setdata.become_commission = become_selfmoney;
  566. //付款后
  567. this.setdata.payment = become_order;
  568. //首单付款
  569. this.setdata.firstOrder = become_child;
  570. //是否审核
  571. this.setdata.rights = become_check;
  572. }
  573. let {
  574. reward_points,
  575. maximum_number
  576. } = reward
  577. if (this.isObject(reward)) {
  578. console.log(454);
  579. //推荐一个人奖励积分
  580. this.reward.integral = reward_points;
  581. //赠送积分最大人数
  582. this.reward.integral_people = maximum_number;
  583. }
  584. let {
  585. is_jump,
  586. share_page,
  587. share_page_deail,
  588. jump_link,
  589. small_jump_link
  590. } = page
  591. if (this.isObject(page))
  592. //推荐中心跳转
  593. this.page.promotion_skip = String(is_jump);
  594. //收入页面
  595. this.page.income_page = String(share_page);
  596. //收入明细
  597. this.page.buyer_info = String(share_page_deail);
  598. //跳转链接
  599. this.page.link = jump_link;
  600. //小程序链接
  601. this.page.applet_link = small_jump_link;
  602. })
  603. },
  604. //弹窗显示与隐藏的控制
  605. changeLink(item) {
  606. this.show = item;
  607. },
  608. //当前链接的增加
  609. parHref(child, confirm) {
  610. this.show = confirm;
  611. this.page.link = child;
  612. },
  613. //小程序链接
  614. changeprogram(item) {
  615. this.pro = item;
  616. },
  617. parpro(child, confirm) {
  618. this.pro = confirm;
  619. this.page.applet_link = child;
  620. },
  621. showLink(type, name) {
  622. if (type == "link") {
  623. this.chooseLink = name;
  624. this.show = true;
  625. } else {
  626. this.chooseMiniLink = name;
  627. this.pro = true;
  628. }
  629. },
  630. isObject(obj) {
  631. if (obj !== null && JSON.stringify(obj) !== "{}") {
  632. return true;
  633. }
  634. },
  635. //上传商品部分
  636. uploadingGoods(i, index) {
  637. //判断点击
  638. if (this.isEvent) {
  639. return
  640. }
  641. //当前点击的东西
  642. this.isIndex = i;
  643. if (index !== undefined) {
  644. //当前点击图片的下标
  645. this.indexImg = index;
  646. }
  647. //点击打开搜索框
  648. this.isUploadingGoos = true;
  649. //请求当前商品的数据
  650. this.postSearch(1);
  651. },
  652. //请求商品信息
  653. postSearch(page) {
  654. this.$http.post("{!!yzWebFullUrl('member.member-level.search-goods')!!}", {
  655. page
  656. }).then(res => {
  657. if (res.data.result === 1) {
  658. this.loading = true;
  659. setTimeout(() => {
  660. this.loading = false;
  661. }, 500)
  662. let {
  663. data: data,
  664. total,
  665. current_page: page,
  666. per_page: size,
  667. } = res.body.data.goods;
  668. console.log(res);
  669. //商品列表
  670. this.gridData = data;
  671. //总数
  672. this.total = total;
  673. //一页显示的数据
  674. this.pagesize = size;
  675. //页码数
  676. this.currentPage = page;
  677. } else {
  678. this.$message.error(res.data.msg);
  679. }
  680. })
  681. },
  682. cancel(i) {
  683. //删除当前图片
  684. this.image.splice(i, 1);
  685. //删除图片文字
  686. this.commodity_title.splice(i, 1);
  687. //删除图片id
  688. this.goodsIdList.splice(i, 1);
  689. },
  690. //提交商品信息
  691. addGoods(val, i) {
  692. if (this.isIndex == 1) {
  693. //商品的图片
  694. this.image.push(val.thumb);
  695. //商品id
  696. // become_goods_id
  697. this.goodsIdList.push(val.id)
  698. //商品名称
  699. this.commodity_title.push(val.title)
  700. } else {
  701. //替换当前图片
  702. //商品的图片
  703. this.image[this.indexImg] = val.thumb;
  704. //商品id
  705. this.goodsIdList[this.indexImg] = val.id;
  706. //商品名称
  707. this.commodity_title[this.indexImg] = val.title;
  708. //替换商品关闭搜索
  709. this.isUploadingGoos = false;
  710. }
  711. },
  712. handleCurrentChange(page) {
  713. if (this.seekInput) {
  714. this.seekBtn(page);
  715. } else {
  716. this.postSearch(page);
  717. }
  718. },
  719. //搜索商品
  720. seekBtn(page) {
  721. console.log(page, 9999);
  722. this.$http.post("{!!yzWebFullUrl('member.member-relation.query')!!}", {
  723. page,
  724. keyword: this.seekInput
  725. }).then(res => {
  726. // console.log(res);
  727. // console.log(res.body.data.data);
  728. let {
  729. data: data,
  730. total,
  731. current_page: page,
  732. per_page: size,
  733. } = res.body.data;
  734. // console.log(data);
  735. this.loading = true;
  736. if (res.data.result == 1) {
  737. setTimeout(() => {
  738. this.loading = false;
  739. }, 300)
  740. // 商品列表
  741. this.gridData = data;
  742. //总数
  743. this.total = total;
  744. //一页显示的数据
  745. this.pagesize = size;
  746. //页码数
  747. this.currentPage = page;
  748. console.log(this.currentPage, 98622);
  749. }
  750. })
  751. },
  752. //保存数据请求
  753. postSave() {
  754. let become_term = {};
  755. this.setdata.become_term.forEach(item => {
  756. become_term[item] = item;
  757. })
  758. this.$http.post("{!!yzWebFullUrl('member.member-relation.save')!!}", {
  759. setdata: {
  760. status: this.setdata.status,
  761. become: this.setdata.become,
  762. become_goods_id: this.goodsIdList,
  763. become_order: this.setdata.payment,
  764. become_child: this.setdata.firstOrder,
  765. become_ordercount: this.setdata.become_ordercount,
  766. become_moneycount: this.setdata.become_moneycount,
  767. become_check: this.setdata.rights,
  768. become_selfmoney: this.setdata.become_commission,
  769. become_term: become_term,
  770. reward_points: this.reward.integral,
  771. maximum_number: this.reward.integral_people,
  772. become_goods: this.goodsTurnJson(),
  773. share_page: this.page.income_page,
  774. share_page_deail: this.page.buyer_info
  775. },
  776. setting: {
  777. is_jump: this.page.promotion_skip,
  778. jump_link: this.page.link,
  779. small_jump_link: this.page.applet_link,
  780. },
  781. }).then((res) => {
  782. console.log(res);
  783. if (res.data.result === 1) {
  784. this.$message.success("设置成功");
  785. history.go(0);
  786. } else {
  787. this.$message.error(res.data.msg)
  788. }
  789. })
  790. },
  791. //转换json格式
  792. goodsTurnJson() {
  793. let Arr = [];
  794. let Obj = null;
  795. this.image.forEach((item, i) => {
  796. Obj = {
  797. goods_id: this.goodsIdList[i],
  798. title: this.commodity_title[i],
  799. thumb: item
  800. }
  801. Arr.push(Obj)
  802. })
  803. let Json = {}
  804. Arr.map((e, i) => {
  805. Json[i] = e;
  806. });
  807. return Json;
  808. },
  809. //提交保存
  810. submit() {
  811. if (this.setdata.become == 0 && this.setdata.firstOrder == 2) {
  812. this.$message.error("无条件和首次付款不能同时选择! 重新选择!")
  813. } else if (this.setdata.become == 0 && this.setdata.firstOrder == 1) {
  814. this.$message.error("无条件和首次下单不能同时选择! 重新选择!")
  815. } else {
  816. //保存当前的设置
  817. this.postSave()
  818. }
  819. }
  820. }
  821. })
  822. </script>
  823. @endsection