goods-list.blade.php 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663
  1. @extends('layouts.base')
  2. @section('title', "添加云仓商品")
  3. @section('content')
  4. <style>
  5. .ml-10 {
  6. margin-left: 10px;
  7. }
  8. .goods_xing ul li {
  9. float: left;
  10. margin-left: 10px;
  11. }
  12. .el-cascader-menu {
  13. height: 200px;
  14. }
  15. </style>
  16. <style>
  17. .el-table .cell{
  18. white-space:pre-line;
  19. }
  20. </style>
  21. <div class="leadgoods">
  22. <div id="app">
  23. <template>
  24. <div class="lead_goods">
  25. <!-- 标题 -->
  26. <div class="title" style="margin:20px;fontSize:16px;border-bottom:1px solid #ccc;padding-bottom:15px;">添加云仓商品</div>
  27. <div class="form-list">
  28. <el-form :inline="true" :model="post_form" ref="post_form" style="margin-left:10px;">
  29. <el-row>
  30. <el-form-item label="" prop="">
  31. <el-select v-model="post_form.goods_status" placeholder="请选择商品状态" clearable>
  32. <el-option v-for="item in goods_status_list" :key="item.id" :label="item.name" :value="item.id"></el-option>
  33. </el-select>
  34. </el-form-item>
  35. <el-form-item label="" prop="">
  36. <el-select v-model="post_form.sell_stock" placeholder="请选择售中库存" clearable>
  37. <el-option v-for="item in sell_stock_list" :key="item.id" :label="item.name" :value="item.id"></el-option>
  38. </el-select>
  39. </el-form-item>
  40. <el-form-item label="" prop="">
  41. <el-select v-model="post_form.status" placeholder="请选择操作状态" clearable>
  42. <el-option v-for="item in status_list" :key="item.id" :label="item.label" :value="item.value"></el-option>
  43. </el-select>
  44. </el-form-item>
  45. <el-form-item>
  46. <el-select v-model="post_form.id_v1" placeholder="请选择一级分类" clearable @change="changeCateV1()">
  47. <el-option v-for="item in category" :key="item.id" :label="item.name" :value="item.id"></el-option>
  48. </el-select>
  49. </el-form-item>
  50. <el-form-item>
  51. <el-select v-model="post_form.id_v2" placeholder="请选择二级分类" clearable @change="changeCateV2()">
  52. <el-option v-for="item in category_v2" :key="item.id" :label="item.name" :value="item.id"></el-option>
  53. </el-select>
  54. </el-form-item>
  55. <el-form-item>
  56. <el-select v-model="post_form.id_v3" placeholder="请选择三级分类" clearable v-if="cate_level==3">
  57. <el-option v-for="item in category_v3" :key="item.id" :label="item.name" :value="item.id"></el-option>
  58. </el-select>
  59. </el-form-item>
  60. <el-form-item label="" prop="">
  61. <el-select v-model="post_form.brand_id" placeholder="请选择品牌" clearable>
  62. <el-option v-for="item in brands_list" :key="item.id" :label="item.name" :value="item.id"></el-option>
  63. </el-select>
  64. </el-form-item>
  65. <el-form-item label="" prop="keyword">
  66. <el-input v-model="post_form.keyword" placeholder="请输入商品ID或关键字"></el-input>
  67. </el-form-item>
  68. <el-form-item label="价格区间" prop="">
  69. <el-input v-model="post_form.min_price" placeholder="最低价" style="width:150px;"></el-input>
  70. <el-input v-model="post_form.max_price" placeholder="最高价" style="width:150px;"></el-input>
  71. </el-form-item>
  72. <el-form-item label="添加时间">
  73. <el-date-picker
  74. v-model="post_form.times"
  75. type="datetimerange"
  76. value-format="yyyy-MM-dd HH:mm:ss"
  77. range-separator="至"
  78. start-placeholder="开始日期"
  79. end-placeholder="结束日期"
  80. style="margin-left:5px;"
  81. align="right">
  82. </el-date-picker>
  83. </el-form-item>
  84. <a href="#">
  85. <el-button type="primary" icon="el-icon-search" @click="getData(1)">搜索</el-button>
  86. </a>
  87. </el-col>
  88. </el-row>
  89. </el-form>
  90. </div>
  91. <div class="table" style="margin-top:10px;margin-left:20px;" >
  92. <el-table ref="multipleTable" max-height="600" :data="tableData" border style="width: 100%" @select="selectchange" @select-all="selectchangeAll" @selection-change="change">
  93. <el-table-column prop="status" type="selection">
  94. </el-table-column>
  95. <el-table-column prop="id" label="id" width="80">
  96. </el-table-column>
  97. <el-table-column prop="thumb" label="商品">
  98. <template slot-scope="scope">
  99. <img :src="scope.row.thumb" alt="" style="display:block;width:80px;height:80px;">
  100. </template>
  101. </el-table-column>
  102. <el-table-column prop="title" label="商品名称">
  103. <template slot-scope="scope">
  104. <a :href="'{{ yzWebFullUrl('plugin.jd-supply.admin.shop-goods.edit', array('id' => '')) }}'+[[scope.row.id]]">
  105. [[scope.row.title]]
  106. </a>
  107. </template>
  108. </el-table-column>
  109. <el-table-column prop="stock" v-bind:label="'市场价格\n销售价格\n成本价格'">
  110. <template slot-scope="scope">
  111. ¥[[scope.row.market_price]]<br>
  112. ¥[[scope.row.price]]<br>
  113. ¥[[scope.row.cost_price]]<br>
  114. </template>
  115. </el-table-column>
  116. <el-table-column prop="stock" v-bind:label="'预计云仓市场价格\n预计云仓指导价格\n预计云仓结算价格'">
  117. <template slot-scope="scope">
  118. ¥[[scope.row.scPrice]]<br>
  119. ¥[[scope.row.yprice]]<br>
  120. ¥[[scope.row.jsPrice]]<br>
  121. </template>
  122. </el-table-column>
  123. <el-table-column prop="stock" label="库存">
  124. <template slot-scope="scope">
  125. <span v-html="scope.row.stock"></span>
  126. </template>
  127. </el-table-column>
  128. <el-table-column prop="real_sales" label="销量">
  129. </el-table-column>
  130. <el-table-column prop="add_status" label="状态">
  131. </el-table-column>
  132. </el-table>
  133. </div>
  134. <!-- 分页 -->
  135. <div class="feiye">
  136. <!-- 分页 -->
  137. <el-row>
  138. <el-col :span="24" align="right" style="padding:15px 5% 15px 0">
  139. <el-pagination
  140. @current-change="handleCurrentChange"
  141. :current-page="currentPage4"
  142. :page-size="page_size"
  143. layout="total, prev, pager, next, jumper"
  144. :total="total">
  145. </el-pagination>
  146. <!-- <el-pagination layout="prev, pager, next " @current-change="handleCurrentChange" :current-page.sync="currentPage4" :total="total" background></el-pagination> -->
  147. </el-col>
  148. </el-row>
  149. </div>
  150. <!-- 线 -->
  151. <div class="xian_goods" style="border-bottom:1px solid #ccc;width:100%;height:1px;margin-top:20px;"></div>
  152. <div class="push_goods_les" style="padding-top: 50px;">
  153. <el-form :inline="true" :model="search_form" ref="search_form" style="margin-left:10px;">
  154. <el-form-item>
  155. <el-select v-model="search_form.cate_v1" placeholder="请选择一级分类" clearable
  156. @change="changeV1()">
  157. <el-option v-for="item in category_list" :key="item.id" :label="item.label"
  158. :value="item.id"></el-option>
  159. </el-select>
  160. </el-form-item>
  161. <el-form-item>
  162. <el-select v-model="search_form.cate_v2" placeholder="请选择二级分类" clearable
  163. @change="changeV2()">
  164. <el-option v-for="item in category_list_v2" :key="item.id"
  165. :label="item.label" :value="item.id"></el-option>
  166. </el-select>
  167. </el-form-item>
  168. <el-form-item>
  169. <el-select v-model="search_form.cate_v3" placeholder="请选择三级分类" clearable>
  170. <el-option v-for="item in category_list_v3" :key="item.id"
  171. :label="item.label" :value="item.id"></el-option>
  172. </el-select>
  173. </el-form-item>
  174. <el-form-item>
  175. <el-select v-model="search_form.after_sale_time" placeholder="售后时长" clearable>
  176. <el-option v-for="item in after_sale_time" :key="item.id"
  177. :label="item.label" :value="item.value"></el-option>
  178. </el-select>
  179. </el-form-item>
  180. <el-form-item>
  181. <el-select v-model="search_form.dispatch" placeholder="运费模板" clearable>
  182. <el-option v-for="item in dispatch_list" :key="item.id"
  183. :label="item.name" :value="item.id"></el-option>
  184. </el-select>
  185. </el-form-item>
  186. <el-form-item>
  187. <el-select v-model="search_form.stags" placeholder="请选择服务标签" clearable>
  188. <el-option v-for="item in stags" :key="item.id"
  189. :label="item.tags" :value="item.id"></el-option>
  190. </el-select>
  191. </el-form-item>
  192. <el-form-item>
  193. <el-select v-model="search_form.delay_compensate" placeholder="发货延期" clearable>
  194. <el-option v-for="item in delay_compensate" :key="item.id"
  195. :label="item.label" :value="item.value"></el-option>
  196. </el-select>
  197. </el-form-item>
  198. <el-form-item label="" prop="goods_des">
  199. <el-input v-model="search_form.goods_des" placeholder="请输入关键词,英文逗号连接 最多5个"></el-input>
  200. </el-form-item>
  201. <el-form-item label="" prop="producing_area">
  202. <el-input v-model="search_form.producing_area" placeholder="请输入产地"></el-input>
  203. </el-form-item>
  204. <el-form-item label="" prop="deliver_area">
  205. <el-input v-model="search_form.deliver_area" placeholder="请输入发货地"></el-input>
  206. </el-form-item>
  207. {{--<el-form-item>--}}
  208. {{--<el-input class="ml-10" clearable v-model="search_form.wlPrice" placeholder="物流费" style="width:126px;"></el-input>--}}
  209. {{--<span>元</span>--}}
  210. {{--</el-form-item>--}}
  211. {{--<el-form-item>--}}
  212. {{--<el-input class="ml-10" clearable v-model="search_form.pywlPrice" placeholder="偏远物流费" style="width:126px;"></el-input>--}}
  213. {{--<span>元</span>--}}
  214. {{--</el-form-item>--}}
  215. </el-form>
  216. </div>
  217. <el-dialog :visible.sync="import_show" width="750px" title="推送全部筛选商品">
  218. <el-col v-if="all_import.import_status == 0" style="color: red">共计推送[[total]]个商品</el-col> <el-col v-if="all_import.import_status == 1" style="color: red">导入商品总数:[[all_import.import_total]]</el-col>
  219. <el-col v-if="all_import.import_status == 1" style="color: red">已推送商品数:[[all_import.import_exits]]</el-col>
  220. <el-col v-if="all_import.import_status == 1" style="color: red">总进度约:[[all_import.import_process]]%</el-col> <span slot="footer" class="dialog-footer">
  221. <el-button @click="import_show = false">取 消</el-button>
  222. <el-button type="primary" :disabled="all_import_disabled" @click="allPushGoods">确认推送</el-button>
  223. </span>
  224. </el-dialog>
  225. <!-- 导入商品 -->
  226. <div class="push_goods_les">
  227. <el-button @click="toggleSelection(tableData)">全选</el-button>
  228. <el-button type="success" ref="but1" style="margin:20px;" @click="pushGoods">推送商品</el-button>
  229. <el-button type="danger" ref="but1" style="" @click="show_all_import()">推送全部商品</el-button>
  230. </div>
  231. </div>
  232. </template>
  233. </div>
  234. </div>
  235. <script>
  236. // let goodsData = JSON.parse('{!! $list !!}');
  237. // console.log(goodsData);
  238. var vm = new Vue({
  239. el: "#app",
  240. delimiters: ['[[', ']]'],
  241. data() {
  242. // let goodsData = JSON.parse('{!! $list !!}');
  243. let all_import = {!! $import?:'{}' !!};
  244. return {
  245. input: '', //关键词
  246. input1: '', //价格数据-到
  247. input2: '', //价格数据
  248. checked: false,
  249. total: 0, //总条数
  250. currentPage4: 1, //当前页数
  251. page_size:0,
  252. search_form: {
  253. cate_v1: '',
  254. cate_v2: '',
  255. cate_v3: '',
  256. stags:'',
  257. delay_compensate:'',
  258. goods_des:'',
  259. deliver_area:'',
  260. },
  261. post_form: {
  262. id_v1: '',
  263. id_v2: '',
  264. id_v3: '',
  265. times:[],
  266. },
  267. goods_status_list:[
  268. {id:'',name:'全部状态'},
  269. {id:'0',name:'下架'},
  270. {id:'1',name:'上架'},
  271. ],
  272. sell_stock_list:[
  273. {id:'',name:'全部'},
  274. {id:'0',name:'售罄'},
  275. {id:'1',name:'出售中'},
  276. ],
  277. brands_list:[],//品牌名称
  278. category_list_all:[],
  279. category_list: [],
  280. category_list_v2: [],
  281. category_list_v3: [],
  282. import_show:false,
  283. all_import_disabled:false,
  284. all_import: all_import,
  285. category_all:[],
  286. category: [],
  287. category_v2: [],
  288. category_v3: [],
  289. after_sale_time: [{
  290. value: 7,
  291. label: '7天'
  292. }, {
  293. value: 15,
  294. label: '15天'
  295. }, {
  296. value: 30,
  297. label: '30天'
  298. }],
  299. delay_compensate:[{
  300. value: 24,
  301. label: '24小时'
  302. }, {
  303. value: 48,
  304. label: '48小时'
  305. }, {
  306. value: 72,
  307. label: '72小时'
  308. },{
  309. value: 0,
  310. label: '0小时'
  311. },],
  312. dispatch_list: [],
  313. status_list: [{
  314. value: '',
  315. label: '状态不限'
  316. }, {
  317. value: '0',
  318. label: '未添加'
  319. }, {
  320. value: '1',
  321. label: '已添加'
  322. }, {
  323. value: '2',
  324. label: '待更新'
  325. }, {
  326. value: '3',
  327. label: '待删除'
  328. }, {
  329. value: '4',
  330. label: '不可操作'
  331. }],
  332. cate_level:2,
  333. selectedOptions: [],
  334. // 表格
  335. tableData: [],
  336. goods_ids:[],//商品id的集合
  337. parentid:'',//一级分类的id
  338. childid:"",//二级分类的ID
  339. stags:[],//服务标签列表
  340. }
  341. },
  342. created () {
  343. this.getData(1);
  344. this.getCategory();
  345. this.getStags();
  346. },
  347. methods: {
  348. // 获取第三方分类、本地分类、品牌
  349. getCategory() {
  350. this.$http.post('{!!yzWebFullUrl('plugin.jd-supply.admin.cloud-manage.get-third-category')!!}').then(res => {
  351. if (res.data.result == '1') {
  352. this.category_list_all = res.data.data.third_category;
  353. this.category_list = res.data.data.third_category;
  354. this.category_all = res.data.data.category.cate;
  355. this.category = res.data.data.category.cate;
  356. this.cate_level = res.data.data.category.cate_level;
  357. this.brands_list = res.data.data.brands;
  358. this.dispatch_list = res.data.data.dispatch;
  359. } else {
  360. this.$message({
  361. type: 'error',
  362. message: res.data.msg
  363. })
  364. }
  365. })
  366. },
  367. //获取服务标签列表
  368. getStags() {
  369. this.$http.post('{!!yzWebFullUrl('plugin.jd-supply.admin.cloud-manage.get-stags-list')!!}').then(res => {
  370. if (res.data.result == '1') {
  371. this.stags = res.data.data;
  372. } else {
  373. this.$message({
  374. type: 'error',
  375. message: res.data.msg
  376. })
  377. }
  378. })
  379. },
  380. changeModel() {
  381. },
  382. // 一级分类改变
  383. changeV1() {
  384. this.search_form.cate_v2 = "";
  385. this.search_form.cate_v3 = "";
  386. this.category_list_v2 = [];
  387. this.category_list_v3 = [];
  388. this.category_list.find(item => {
  389. if (item.id == this.search_form.cate_v1) {
  390. this.category_list_v2 = item.children;
  391. }
  392. });
  393. },
  394. // 二级分类改变
  395. changeV2() {
  396. this.search_form.cate_v3 = "";
  397. this.category_list_v3 = [];
  398. this.category_list_v2.find(item => {
  399. if (item.id == this.search_form.cate_v2) {
  400. this.category_list_v3 = item.children;
  401. }
  402. })
  403. },
  404. // 一级分类改变
  405. changeCateV1() {
  406. this.post_form.id_v2 = "";
  407. this.post_form.id_v3 = "";
  408. this.category_v2 = [];
  409. this.category_v3 = [];
  410. this.category.find(item => {
  411. if (item.id == this.post_form.id_v1) {
  412. this.category_v2 = item.childrens;
  413. }
  414. });
  415. },
  416. // 二级分类改变
  417. changeCateV2() {
  418. this.post_form.id_v3 = "";
  419. this.category_v3 = [];
  420. this.category_v2.find(item => {
  421. if (item.id == this.post_form.id_v2) {
  422. this.category_v3 = item.childrens;
  423. }
  424. })
  425. },
  426. show_all_import()
  427. {
  428. if (this.all_import.import_status == 1) {
  429. this.all_import_disabled = true
  430. }
  431. this.import_show = true;
  432. },
  433. // 获取数据
  434. getData(page){
  435. var that = this;
  436. console.log(page);
  437. let json = {
  438. page:page,
  439. search:{
  440. keyword:that.post_form.keyword,
  441. status:that.post_form.status,
  442. goods_status:that.post_form.goods_status,
  443. sell_stock:that.post_form.sell_stock,
  444. brand_id:that.post_form.brand_id,
  445. min_price:that.post_form.min_price,
  446. max_price:that.post_form.max_price,
  447. parentid:that.post_form.id_v1,
  448. childid:that.post_form.id_v2,
  449. thirdid:that.post_form.id_v3,
  450. start_time:that.post_form.times[0],
  451. end_time:that.post_form.times[1],
  452. },
  453. };
  454. let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
  455. this.$http.post('{!!yzWebFullUrl('plugin.jd-supply.admin.cloud-manage.get-list')!!}',json).then(res=>{
  456. if (res.data.result=='1') {
  457. this.currentPage4=res.data.data.list.current_page
  458. this.total=res.data.data.list.total;
  459. this.page_size = res.data.data.list.per_page;
  460. this.tableData=res.data.data.list.data;
  461. loading.close();
  462. }else{
  463. this.$message({
  464. type:'error',
  465. message:res.data.msg
  466. })
  467. loading.close();
  468. }
  469. })
  470. },
  471. // 一级分类触发
  472. handleChange(value) {
  473. this.parentid=value[0]
  474. this.childid=value[1]
  475. console.log(value);
  476. },
  477. // 搜索
  478. searchAll() {
  479. this.currentPage4=1;
  480. let searchobj = {
  481. search: {
  482. keyword: this.input, //搜索的关键词
  483. status: this.selectedOptions[0], //选择状态
  484. min_price: this.input1, //价格区间
  485. max_price: this.input2
  486. },
  487. page:this.currentPage4
  488. }
  489. var reg = /^[0-9]*$/;
  490. // 判断是否数字类型的值
  491. if (!reg.test(this.input1) || !reg.test(this.input2)) {
  492. this.$message.error('请输入正整数类型的值')
  493. } else {
  494. this.getData(searchobj)
  495. }
  496. },
  497. // 改变
  498. checkXuan(row) {
  499. console.log(row);
  500. },
  501. // 添加商品
  502. pushGoods() {
  503. var that = this;
  504. let goods={
  505. goods_ids:this.goods_ids,
  506. search_form:this.search_form,
  507. };
  508. this.$refs.but1.disabled = 'disabled';
  509. this.$http.post('{!!yzWebFullUrl('plugin.jd-supply.admin.cloud-manage.push-goods')!!}',goods).then(res=>{
  510. if (res.data.result == '1') {
  511. this.$message.success(res.data.msg)
  512. this.getData()
  513. }else{
  514. this.$message.error(res.data.msg)
  515. }
  516. this.$refs.but1.disabled = '';
  517. })
  518. console.log('导入商品');
  519. },
  520. // 添加商品
  521. allPushGoods() {
  522. var that = this;
  523. that.all_import_disabled = true
  524. let goods={
  525. search_form:this.search_form,
  526. search:{
  527. keyword:that.post_form.keyword,
  528. status:that.post_form.status,
  529. goods_status:that.post_form.goods_status,
  530. sell_stock:that.post_form.sell_stock,
  531. brand_id:that.post_form.brand_id,
  532. min_price:that.post_form.min_price,
  533. max_price:that.post_form.max_price,
  534. parentid:that.post_form.id_v1,
  535. childid:that.post_form.id_v2,
  536. thirdid:that.post_form.id_v3,
  537. start_time:that.post_form.times[0],
  538. end_time:that.post_form.times[1],
  539. }
  540. };
  541. //this.$refs.but1.disabled = 'disabled';
  542. this.$http.post('{!!yzWebFullUrl('plugin.jd-supply.admin.cloud-manage.all-push-goods')!!}',goods).then(res=>{
  543. if (res.data.result == '1') {
  544. this.$message.success(res.data.msg)
  545. location.reload()
  546. }else{
  547. this.$message.error(res.data.msg)
  548. }
  549. this.$refs.but1.disabled = '';
  550. })
  551. console.log('导入商品');
  552. },
  553. updategoods() {
  554. let goods={
  555. goods_ids:this.goods_ids,
  556. };
  557. this.$http.post('{!!yzWebFullUrl('plugin.tripartite-provider.admin.tripartiteProviderGoods.update.ajax')!!}',goods).then(res=>{
  558. if (res.data.result=='1') {
  559. this.$message.success(res.data.msg)
  560. this.getData()
  561. }else{
  562. this.$message.error(res.data.msg)
  563. }
  564. })
  565. console.log('导入商品');
  566. },
  567. deletegoods() {
  568. let goods={
  569. goods_ids:this.goods_ids,
  570. };
  571. this.$http.post('{!!yzWebFullUrl('plugin.tripartite-provider.admin.tripartiteProviderGoods.delete.ajax')!!}',goods).then(res=>{
  572. if (res.data.result=='1') {
  573. this.$message.success(res.data.msg)
  574. this.getData()
  575. }else{
  576. this.$message.error(res.data.msg)
  577. }
  578. })
  579. console.log('导入商品');
  580. },
  581. handleSizeChange(val) {
  582. console.log(`每页 ${val} 条`);
  583. },
  584. handleCurrentChange(val) {
  585. let changeObj = {
  586. search: {
  587. keyword: this.input, //搜索的关键词
  588. status: this.selectedOptions[0], //选择状态
  589. min_price: this.input1, //价格区间
  590. max_price: this.input2,
  591. },
  592. page:val
  593. };
  594. this.getData(val)
  595. console.log(`当前页: ${val}`);
  596. },
  597. // 勾选数据行的 Checkbox 时触发的事件
  598. selectchange(selection, row) {
  599. console.log(selection, row,'勾选');
  600. var ids=[]
  601. // 循环遍历得到所有勾选上的id的值
  602. selection.map(item=>{
  603. ids.push(item.id)
  604. })
  605. this.goods_ids=ids;
  606. console.log(this.goods_ids,'勾选时商品id的集合');
  607. },
  608. // 全选 Checkbox 时触发的事件
  609. selectchangeAll(selection) {
  610. var ids=[]
  611. selection.map(item=>{
  612. ids.push(item.id)
  613. })
  614. this.goods_ids=ids;
  615. console.log(this.goods_ids,'全选时商品id的集合');
  616. console.log(selection,'全选');
  617. },
  618. // 当选择项发生变化时会触发该事件
  619. change(selection) {
  620. console.log(selection);
  621. },
  622. toggleSelection(rows) {
  623. if (rows) {
  624. rows.forEach(row => {
  625. this.$refs.multipleTable.toggleRowSelection(row,true);
  626. });
  627. }
  628. var ids=[]
  629. rows.map(item=>{
  630. ids.push(item.id)
  631. })
  632. this.goods_ids=ids;
  633. },
  634. },
  635. })
  636. </script>
  637. @endsection