detail.blade.php 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752
  1. @extends('layouts.base')
  2. @section('title', '团购')
  3. @section('content')
  4. <style>
  5. .content {
  6. background: #eff3f6;
  7. padding: 10px !important;
  8. }
  9. .con {
  10. padding-bottom: 20px;
  11. position: relative;
  12. min-height: 100vh;
  13. background-color: #fff;
  14. border-radius: 8px;
  15. }
  16. .con .setting .block {
  17. padding: 10px;
  18. background-color: #fff;
  19. border-radius: 8px;
  20. }
  21. .con .setting .block .title {
  22. display: flex;
  23. align-items: center;
  24. margin-bottom: 15px;
  25. }
  26. .confirm-btn {
  27. width: calc(100% - 266px);
  28. position: fixed;
  29. bottom: 0;
  30. right: 0;
  31. margin-right: 10px;
  32. line-height: 63px;
  33. background-color: #ffffff;
  34. box-shadow: 0px 8px 23px 1px rgba(51, 51, 51, 0.3);
  35. background-color: #fff;
  36. text-align: center;
  37. }
  38. b {
  39. font-size: 14px;
  40. }
  41. .vue-crumbs a {
  42. color: #333;
  43. }
  44. .vue-crumbs a:hover {
  45. color: #29ba9c;
  46. }
  47. .vue-crumbs {
  48. margin: 0 20px;
  49. font-size: 14px;
  50. color: #333;
  51. font-weight: 400;
  52. padding-bottom: 10px;
  53. line-height: 32px;
  54. }
  55. .panel {
  56. margin-bottom: 10px !important;
  57. padding-left: 20px;
  58. border-radius: 10px;
  59. }
  60. .panel .active a {
  61. background-color: #29ba9c !important;
  62. border-radius: 18px !important;
  63. color: #fff;
  64. }
  65. .panel a {
  66. border: none !important;
  67. background-color: #fff !important;
  68. }
  69. .content {
  70. background: #eff3f6;
  71. padding: 10px !important;
  72. }
  73. .con {
  74. padding-bottom: 20px;
  75. border-radius: 8px;
  76. position: relative;
  77. min-height: 100vh;
  78. background-color: #fff;
  79. }
  80. .con .setting .block {
  81. padding: 10px;
  82. background-color: #fff;
  83. border-radius: 8px;
  84. margin-bottom: 10px;
  85. }
  86. .con .setting .block .title {
  87. font-size: 18px;
  88. margin-bottom: 15px;
  89. display: flex;
  90. align-items: center;
  91. }
  92. .confirm-btn {
  93. width: calc(100% - 266px);
  94. position: fixed;
  95. bottom: 0;
  96. right: 0;
  97. margin-right: 10px;
  98. line-height: 63px;
  99. background-color: #ffffff;
  100. box-shadow: 0px 8px 23px 1px rgba(51, 51, 51, 0.3);
  101. background-color: #fff;
  102. text-align: center;
  103. }
  104. b {
  105. font-size: 14px;
  106. }
  107. .add-goods {
  108. width: 120px;
  109. height: 120px;
  110. border: dashed 1px #dde2ee;
  111. display: flex;
  112. flex-direction: column;
  113. justify-content: center;
  114. align-items: center;
  115. }
  116. </style>
  117. <link rel="stylesheet" href="{{resource_get('plugins/package-deliver/views/index.css')}}">
  118. <!-- <script src="{{resource_get('app/common/components/ueditor/dialogs/map/getscript.js?v=1.1&ak=&services=true&t=20130716024058')}}"></script> -->
  119. <!-- <script type="text/javascript" src="https://api.map.baidu.com/api?v=2.0&ak=QXSZyPZk26shrYzAXjTkDLx5LbRCHECz"></script> -->
  120. <!-- app\common\components\ueditor\dialogs\map\getscript.js -->
  121. <div class="all">
  122. <div id="app" v-cloak>
  123. <el-form ref="form" :model="form" :rules="rules" label-width="15%">
  124. <div class="vue-main">
  125. <div class="vue-main-title">
  126. <div class="vue-main-title-left"></div>
  127. <div class="vue-main-title-content">活动基本信息</div>
  128. </div>
  129. <div class="vue-main-form">
  130. <el-form-item label="活动名称" prop="title">
  131. <el-input v-model="form.title" style="width:70%;"></el-input>
  132. </el-form-item>
  133. <el-form-item label="颜色" prop="color">
  134. <el-color-picker v-model="form.color"></el-color-picker>
  135. </el-form-item>
  136. <el-form-item label="分享图片" prop="share_img">
  137. <div class="upload-box" @click="openUpload('share_img')" v-if="!form.share_img">
  138. <i class="el-icon-plus" style="font-size:32px"></i>
  139. </div>
  140. <div @click="openUpload('share_img')" class="upload-boxed" v-if="form.share_img">
  141. <img :src="form.share_img_url" alt=""
  142. style="width:150px;height:150px;border-radius: 5px;cursor: pointer;">
  143. <div class="upload-boxed-text">点击重新上传</div>
  144. </div>
  145. </el-form-item>
  146. <el-form-item label="活动时间">
  147. <el-date-picker
  148. v-model="times"
  149. type="datetimerange"
  150. range-separator="至"
  151. start-placeholder="开始日期"
  152. end-placeholder="结束日期"
  153. align="right">
  154. </el-date-picker>
  155. </el-form-item>
  156. <el-form-item label="自提点范围" prop="is_all_area">
  157. <el-radio-group v-model="form.is_all_area" style="margin-top:10px">
  158. <el-radio :label="1">全部自提点</el-radio>
  159. <el-radio :label="0">指定地区自提点</el-radio>
  160. </el-radio-group>
  161. </el-form-item>
  162. <el-form-item label="自提范围">
  163. <template slot-scope="scope">
  164. <el-button @click="openVisible()" type="primary">选择区域</el-button>
  165. <div style="text-align:left;margin-top:20px;">
  166. <span class="item" v-for="(item,index) in form.areas">
  167. [[item.areaname]],
  168. </span>
  169. </div>
  170. </template>
  171. </el-form-item>
  172. <el-form-item label="注:">
  173. 指定地区自提点,至少选择一个自提点
  174. 活动开始以后不支持修改自提点范围
  175. </el-form-item>
  176. <el-form-item label="活动商品">
  177. <div style="display:flex;flex-wrap: wrap;">
  178. <div class="good" v-for="(item,index,key) in thumbList"
  179. style="width:120px;display:flex;margin-right:20px;flex-direction: column">
  180. <div class="img" style="position:relative;">
  181. <a style="color:#333;">
  182. <div style="width: 20px;height: 20px;background-color: #dde2ee;display:flex;align-items:center;justify-content:center; #999999;position:absolute;right:-10px;top:-10px;border-radius:50%;"
  183. @click="delGoods(item)">X
  184. </div>
  185. </a>
  186. <img :src="item.thumb" style="width:120px;height:120px;">
  187. </div>
  188. <div style="display: -webkit-box;-webkit-box-orient: vertical;-webkit-line-clamp: 2;overflow: hidden;font-size:12px;">
  189. [[item.title]][ID:[[item.id]]]
  190. </div>
  191. </div>
  192. <div class="add-goods" @click="openGoods()">
  193. <a style="font-size:32px;color: #999999;"><i class="el-icon-plus"></i></a>
  194. <div style="color: #999999;">选择商品</div>
  195. </div>
  196. </div>
  197. </el-form-item>
  198. <el-form-item label="注:">
  199. 只能选择平台自营、租赁、供应商、聚合供应链商品!其中,如果一个活动包含租赁商品,则其余商品也必须为租赁商品!
  200. </el-form-item>
  201. </div>
  202. </div>
  203. <div class="vue-head" style="margin-top:20px">
  204. <div class="vue-main-title">
  205. <div class="vue-main-title-left"></div>
  206. <div class="vue-main-title-content">活动描述</div>
  207. </div>
  208. <div class="vue-main-form">
  209. <!-- <el-form-item label="" prop="desc"> -->
  210. <div style="width:85%;margin:0 auto">
  211. <tinymceee v-model="form.description"></tinymceee>
  212. </div>
  213. <!-- </el-form-item> -->
  214. </div>
  215. </div>
  216. <div class="vue-page">
  217. <div class="vue-center">
  218. <el-button type="primary" @click="submitForm('form')">保存设置</el-button>
  219. <el-button @click="goBack">返回</el-button>
  220. </div>
  221. </div>
  222. <el-dialog title="请选择地区" :visible.sync="centerDialogVisible" center v-if="showVisible"
  223. :before-close="beforeClose">
  224. <el-tree
  225. v-loading="loading"
  226. :props="defaultProps"
  227. node-key="id"
  228. :default-checked-keys="chooseItem.areaIds"
  229. :default-expanded-keys="chooseItem.expend_ids"
  230. show-checkbox
  231. lazy
  232. @check-change="checkAreas"
  233. ref="addressTree"
  234. :data="treeData"
  235. :load="loadNode"
  236. style="height:500px;overflow:auto"
  237. >
  238. </el-tree>
  239. <span slot="footer" class="dialog-footer">
  240. <el-button @click="beforeClose">取 消</el-button>
  241. <el-button type="primary" @click="saveAreas">确 定</el-button>
  242. </span>
  243. </el-dialog>
  244. <el-dialog :visible.sync="goodsShow" width="60%" center title="选择商品">
  245. <div>
  246. <div style="text-align: center">
  247. <el-input v-model="search_form.keyword" style="width:80%"></el-input>
  248. <el-button type="primary" @click="searchGoods()" style="margin-left:20px;">搜索</el-button>
  249. </div>
  250. <el-table :data="goods_list" style="width: 100%;height:500px;overflow:auto">
  251. <el-table-column label="ID" prop="id" align="center"></el-table-column>
  252. <el-table-column label="商品信息" align="center">
  253. <template slot-scope="scope">
  254. <div v-if="scope.row"
  255. style="display:flex;align-items: center;justify-content:center;">
  256. <img v-if="scope.row.thumb" :src="scope.row.thumb"
  257. style="width:50px;height:50px"></img>
  258. <div style="margin-left:10px">[[scope.row.title]]</div>
  259. </div>
  260. </template>
  261. </el-table-column>
  262. <el-table-column prop="refund_time" label="操作" align="center">
  263. <template slot-scope="scope">
  264. <el-button @click="sureGoods(scope.row)">
  265. 选择
  266. </el-button>
  267. </template>
  268. </el-table-column>
  269. </el-table>
  270. </div>
  271. <el-row>
  272. <el-col :span="24" align="right" migra style="padding:15px 5% 15px 0" v-loading="loading">
  273. <el-pagination background layout="prev, pager, next" @current-change="currentChange"
  274. :total="page_total"
  275. :page-size="page_size" :current-page="current_page"></el-pagination>
  276. </el-col>
  277. </el-row>
  278. </el-dialog>
  279. </el-form>
  280. <upload-img :upload-show="uploadShow" :name="chooseImgName" @replace="changeProp"
  281. @sure="sureImg"></upload-img>
  282. <upload-img-list :upload-list-show="uploadListShow" :name="chooseImgListName" @replace="changeListProp"
  283. @sure="sureImgList"></upload-img-list>
  284. </div>
  285. </div>
  286. <script src="{{resource_get('static/yunshop/tinymce4.7.5/tinymce.min.js')}}"></script>
  287. <!-- <script src="{{resource_get('static/yunshop/tinymceTemplate.js')}}"></script> -->
  288. @include('public.admin.tinymceee')
  289. @include('public.admin.uploadImg')
  290. @include('public.admin.uploadImgList')
  291. <script>
  292. // var top_left_control = new BMap.ScaleControl({anchor: BMAP_ANCHOR_TOP_LEFT});// 左上角,添加比例尺
  293. // var top_left_navigation = new BMap.NavigationControl(); //左上角,添加默认缩放平移控件
  294. // var top_right_navigation = new BMap.NavigationControl({anchor: BMAP_ANCHOR_TOP_RIGHT, type: BMAP_NAVIGATION_CONTROL_SMALL}); //右上角,仅包含平移和缩放按钮
  295. /*缩放控件type有四种类型:
  296. BMAP_NAVIGATION_CONTROL_SMALL:仅包含平移和缩放按钮;BMAP_NAVIGATION_CONTROL_PAN:仅包含平移按钮;BMAP_NAVIGATION_CONTROL_ZOOM:仅包含缩放按钮*/
  297. var app = new Vue({
  298. el: "#app",
  299. delimiters: ['[[', ']]'],
  300. name: 'test',
  301. data() {
  302. let id = {!! $id?:0 !!};
  303. console.log(id);
  304. return {
  305. id: id,
  306. form: {
  307. title: '',
  308. color: '',
  309. is_all_area: '',
  310. description: '',
  311. goods: [],
  312. areaData: {},
  313. },
  314. uploadShow: false,
  315. chooseImgName: '',
  316. submit_url: '',
  317. times: [],
  318. uploadListShow: false,
  319. chooseImgListName: '',
  320. list: [],
  321. dialogVisible: false,
  322. thumbList: [],
  323. goodsShow: false,
  324. goods_list: [],
  325. page_total: 0,
  326. page_size: 0,
  327. current_page: 0,
  328. search_form: {
  329. keyword: '',
  330. },
  331. selectGoods: [],
  332. areas: {
  333. ids: []
  334. },
  335. chooseItem: {
  336. areaIds: [],
  337. expend_ids: []
  338. },
  339. centerDialogVisible: false,
  340. showVisible: false,
  341. defaultProps: {
  342. label: 'areaname',
  343. children: 'children',
  344. isLeaf: 'isLeaf'
  345. },
  346. loading: false,
  347. treeData: [],
  348. street: [],
  349. rules: {
  350. store_name: {required: true, message: '请输入门店名称'},
  351. thumb: {required: true, message: '请选择门店logo'},
  352. banner_thumb: {required: true, message: '请选择门店banner图'},
  353. category_id: {required: true, message: '请选择分类'},
  354. province_id: {required: true, message: '请选择地址'},
  355. address: {required: true, message: '请输入详细地址'},
  356. },
  357. }
  358. },
  359. created() {
  360. },
  361. mounted() {
  362. // this.initMap();
  363. this.id = this.getParam("groupId");
  364. this.submit_url = `{!! yzWebFullUrl('plugin.package-deliver.admin.communityGroups.editPost') !!}`;
  365. if (this.id) {
  366. this.getData();
  367. }
  368. },
  369. methods: {
  370. openVisible() {
  371. this.centerDialogVisible = true;
  372. this.showVisible = true;
  373. this.chooseItem.areaIds = this.areas.ids;
  374. },
  375. loadNode(node, resolve) {
  376. this.loading = true;
  377. this.$http.get("{!! yzWebUrl('area.list', ['parent_id'=> '']) !!}" + node.data.id).then(response => {
  378. response.data.data.forEach(function (city) {
  379. city.isLeaf = false;
  380. if (city.level == 3) {
  381. city.isLeaf = true;
  382. }
  383. })
  384. resolve(response.data.data);
  385. // 载入数据后,刷新已选中
  386. this.loading = false;
  387. }, response => {
  388. console.log(response);
  389. });
  390. },
  391. checkAreas(node, checked, children) {
  392. if (checked && node.level < 3) {
  393. if (this.chooseItem.expend_ids.indexOf(node.id) == -1) {
  394. this.chooseItem.expend_ids.push(node.id)
  395. }
  396. //子集也展开
  397. if (node.level == 1) {
  398. this.$http.get("{!! yzWebUrl('area.list', ['parent_id'=> '']) !!}" + node.id).then(response => {
  399. if (response.data.data.length > 0) {
  400. for (var i = 0; i < response.data.data.length; i++) {
  401. if (this.chooseItem.expend_ids.indexOf(response.data.data[i].id) == -1) {
  402. this.chooseItem.expend_ids.push(response.data.data[i].id)
  403. }
  404. }
  405. }
  406. }, response => {
  407. console.log(response);
  408. });
  409. }
  410. }
  411. },
  412. saveAreas() {
  413. var data = [];
  414. var ids = [];
  415. var eids = [];
  416. this.$refs.addressTree.getCheckedNodes().forEach(function (node) {
  417. data.push({'area_id': node.id, 'level': node.level, 'areaname': node.areaname});
  418. ids.push(node.id);
  419. if (node.level != 3) {
  420. eids.push(node.id);
  421. }
  422. });
  423. this.$refs.addressTree.getHalfCheckedNodes().forEach(function (node) {
  424. data.push({'area_id': node.id, 'level': node.level, 'areaname': node.areaname});
  425. // ids.push(node.id);
  426. if (node.level != 3) {
  427. eids.push(node.id);
  428. }
  429. });
  430. this.areas.ids = ids;
  431. this.chooseItem.areaSaveData = data;
  432. this.chooseItem.expend_ids = eids;
  433. this.form.areas = data;
  434. console.log(this.chooseItem);
  435. this.centerDialogVisible = false
  436. this.showVisible = false;
  437. },
  438. beforeClose() {
  439. this.centerDialogVisible = false;
  440. this.showVisible = false;
  441. },
  442. getData() {
  443. let loading = this.$loading({
  444. target: document.querySelector(".content"),
  445. background: 'rgba(0, 0, 0, 0)'
  446. });
  447. this.$http.post('{!! yzWebFullUrl('plugin.package-deliver.admin.communityGroups.getGroupOne') !!}', {id: this.id}).then(function (response) {
  448. if (response.data.result) {
  449. this.form = {
  450. ...response.data.data,
  451. };
  452. this.form.share_img_url = this.form.share_img || ''
  453. this.times = [new Date(response.data.data.start_time), new Date(response.data.data.end_time)];
  454. this.form.goods = []
  455. if (response.data.data.goods) {
  456. this.selectGoods = response.data.data.goods
  457. this.selectGoods.forEach((item, index, key) => {
  458. this.thumbList.push(item)
  459. this.form.goods.push(item.id);
  460. })
  461. }
  462. if (response.data.data.has_many_area) {
  463. var areas = response.data.data.has_many_area;
  464. this.form.areas = [];
  465. areas.forEach((item, index) => {
  466. if(!item.belongs_to_area){
  467. return
  468. }
  469. if (item.level != 3) {
  470. this.chooseItem.expend_ids.push(item.area_id);
  471. } else {
  472. this.areas.ids.push(item.area_id);
  473. }
  474. var data = {
  475. 'area_id': item.area_id,
  476. 'level': item.level,
  477. 'areaname': item.belongs_to_area.areaname,
  478. checked: true
  479. };
  480. this.form.areas.push(data);
  481. })
  482. console.log(this.chooseItem);
  483. }
  484. } else {
  485. this.$message({message: response.data.msg, type: 'error'});
  486. }
  487. loading.close();
  488. }, function (response) {
  489. this.$message({message: response.data.msg, type: 'error'});
  490. loading.close();
  491. }
  492. );
  493. },
  494. goParent() {
  495. window.location.href = `{!! yzWebFullUrl('plugin.package-deliver.admin.communityGroups.manage') !!}`;
  496. },
  497. submitForm(formName) {
  498. // console.log(this.form)
  499. // console.log(this.$refs);
  500. let that = this;
  501. let json = {
  502. title: this.form.title,
  503. color: this.form.color,
  504. description: this.form.description,
  505. share_img: this.form.share_img,
  506. // start_time:this.form.start_time,
  507. // end_time:this.form.end_time,
  508. // province_id:this.form.province_id,
  509. // city_id:this.form.city_id,
  510. // district_id:this.form.district_id,
  511. // street_id:this.form.street_id,
  512. // min_people_count:this.form.min_people_count,
  513. // min_order_count:this.form.min_order_count,
  514. // min_total_amount:this.form.min_total_amount,
  515. is_all_area: this.form.is_all_area,
  516. // group_condition_status:this.form.group_condition_status,
  517. goods: this.form.goods,
  518. areas: this.chooseItem.areaSaveData,
  519. };
  520. if (this.times && this.times.length > 0) {
  521. json.start_time = (new Date(this.times[0]).getTime()) / 1000;
  522. json.end_time = (new Date(this.times[1]).getTime()) / 1000;
  523. }
  524. // console.log(json);
  525. this.$refs[formName].validate((valid) => {
  526. if (valid) {
  527. let loading = this.$loading({
  528. target: document.querySelector(".content"),
  529. background: 'rgba(0, 0, 0, 0)'
  530. });
  531. this.$http.post(this.submit_url, {group: json, id: this.id}).then(response => {
  532. if (response.data.result) {
  533. this.$message({type: 'success', message: '操作成功!'});
  534. this.goParent();
  535. } else {
  536. let msg = '';
  537. let tips = '';
  538. try {
  539. msg = JSON.parse(response.data.msg);
  540. } catch (e) {
  541. tips = response.data.msg;
  542. }
  543. if (msg instanceof Object) {
  544. for (let key in msg) {
  545. tips += msg[key];
  546. }
  547. }
  548. this.$message({message: tips ? tips : response.data.msg, type: 'error'});
  549. }
  550. loading.close();
  551. }, response => {
  552. loading.close();
  553. });
  554. } else {
  555. // console.log('error submit!!');
  556. return false;
  557. }
  558. });
  559. },
  560. goBack() {
  561. history.go(-1)
  562. },
  563. openUpload(str) {
  564. this.chooseImgName = str;
  565. this.uploadShow = true;
  566. },
  567. changeProp(val) {
  568. if (val == true) {
  569. this.uploadShow = false;
  570. } else {
  571. this.uploadShow = true;
  572. }
  573. },
  574. sureImg(name, image, image_url) {
  575. this.form[name] = image;
  576. this.form[name + '_url'] = image_url;
  577. },
  578. clearImg(str, type, index) {
  579. if (!type) {
  580. this.form[str] = "";
  581. this.form[str + '_url'] = "";
  582. } else {
  583. this.form[str].splice(index, 1);
  584. this.form[str + '_url'].splice(index, 1);
  585. }
  586. this.$forceUpdate();
  587. },
  588. openListUpload(str) {
  589. this.chooseImgListName = str;
  590. this.uploadListShow = true;
  591. },
  592. changeListProp(val) {
  593. if (val == true) {
  594. this.uploadListShow = false;
  595. } else {
  596. this.uploadListShow = true;
  597. }
  598. },
  599. sureImgList(name, image, image_url) {
  600. // console.log(name)
  601. // console.log(image)
  602. // console.log(image_url)
  603. if (!this.form[name] || !this.form[name + '_url']) {
  604. this.form[name] = [];
  605. this.form[name + '_url'] = [];
  606. }
  607. image.forEach((item, index) => {
  608. this.form[name].push(item);
  609. this.form[name + '_url'].push(image_url[index]);
  610. })
  611. // console.log(this.form)
  612. },
  613. getParam(name) {
  614. return location.href.match(new RegExp("[?#&]" + name + "=([^?#&]+)", "i"))
  615. ? RegExp.$1
  616. : "";
  617. },
  618. gotoDelivery() {
  619. let link = `{!! yzWebFullUrl('plugin.store-cashier.admin.delivery.index') !!}` + `&store_id=` + this.id;
  620. window.location.href = link;
  621. },
  622. openGoods() {
  623. this.goodsShow = true;
  624. },
  625. delGoods(item) {
  626. this.thumbList.forEach((list, index) => {
  627. if (list.id == item.id) {
  628. this.thumbList.splice(index, 1)
  629. this.form.goods.splice(index, 1)
  630. }
  631. })
  632. },
  633. currentChange(val) {
  634. this.loading = true;
  635. this.$http.post('{!! yzWebFullUrl('plugin.package-deliver.admin.communityGroups.getSearchGoodsJson') !!}', {
  636. page: val,
  637. search: this.search_form.keyword
  638. }).then(function (response) {
  639. let datas = response.data.data.goods;
  640. this.page_total = datas.total;
  641. this.goods_list = datas.data;
  642. this.page_size = datas.per_page;
  643. this.current_page = datas.current_page;
  644. this.loading = false;
  645. }, function (response) {
  646. // console.log(response);
  647. this.loading = false;
  648. }
  649. );
  650. },
  651. searchGoods() {
  652. let that = this;
  653. this.$http.post('{!! yzWebFullUrl('plugin.package-deliver.admin.communityGroups.getSearchGoodsJson') !!}', {search: this.search_form.keyword}).then(response => {
  654. if (response.data.result) {
  655. let data = response.data.data.goods;
  656. this.page_total = data.total;
  657. this.goods_list = data.data;
  658. this.page_size = data.per_page;
  659. this.current_page = data.current_page;
  660. } else {
  661. this.$message({message: response.data.msg, type: 'error'});
  662. }
  663. }, response => {
  664. this.$message({message: response.data.msg, type: 'error'});
  665. });
  666. },
  667. sureGoods(item) {
  668. var status = 0;
  669. // console.log(this.form.goods);
  670. if (this.form.goods.length > 0) {
  671. this.form.goods.some((list, index, key) => {
  672. if (list == item.id) {
  673. status = 1
  674. this.$message({message: '该商品已被选中', type: 'error'});
  675. return true
  676. }
  677. })
  678. }
  679. if (status == 1) {
  680. return false
  681. }
  682. this.thumbList.push(item)
  683. this.form.goods.push(item.id)
  684. },
  685. },
  686. })
  687. </script>
  688. @endsection