list.blade.php 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779
  1. @extends('layouts.base')
  2. @section('content')
  3. @section('title', trans('商品列表'))
  4. <link rel="stylesheet" type="text/css" href="{{static_url('yunshop/goods/vue-goods.css')}}"/>
  5. <div id="qrcode" ref="qrcode" style="display:none;"></div>
  6. <div class="right-titpos">
  7. <ul class="add-snav">
  8. <li class="active"><a href="#">商品列表</a></li>
  9. <a class="btn btn-primary" href="{!! yzWebUrl('plugin.auction.admin.auction.create') !!}"><i class="fa fa-plus"></i>发布商品</a>
  10. </ul>
  11. </div>
  12. <div class="rightlist">
  13. <div id="auction" v-cloak v-loading="all_loading">
  14. <template>
  15. <div class="second-list">
  16. <div class="third-list">
  17. <div class="form-list">
  18. <el-form :inline="true" :model="search_form" ref="search_form" style="margin-left:10px;">
  19. <el-row>
  20. <el-form-item label="" prop="">
  21. <el-input v-model="search_form.goods_id" placeholder="请输入拍品ID"></el-input>
  22. </el-form-item>
  23. <el-form-item label="" prop="">
  24. <el-input v-model="search_form.keyword" placeholder="请输入拍品名称"></el-input>
  25. </el-form-item>
  26. <el-form-item label="" prop="">
  27. <el-input v-model="search_form.auctioneer" placeholder="会员ID/昵称/姓名/手机号"></el-input>
  28. </el-form-item>
  29. <el-form-item label="" prop="">
  30. <el-select v-model="search_form.authentication" placeholder="拍卖官认证" clearable>
  31. <el-option v-for="item in authentication_type" :key="item.id" :label="item.name" :value="item.id"></el-option>
  32. </el-select>
  33. </el-form-item>
  34. <el-form-item label="" prop="">
  35. <el-select v-model="search_form.status" placeholder="上架状态" clearable>
  36. <el-option v-for="item in status_list" :key="item.id" :label="item.name" :value="item.id"></el-option>
  37. </el-select>
  38. </el-form-item>
  39. <el-form-item>
  40. <el-select v-model="search_form.id_v1" placeholder="请选择一级分类" clearable @change="changeV1()">
  41. <el-option v-for="item in category_list" :key="item.id" :label="item.name" :value="item.id"></el-option>
  42. </el-select>
  43. </el-form-item>
  44. <el-form-item>
  45. <el-select v-model="search_form.id_v2" placeholder="请选择二级分类" clearable @change="changeV2()">
  46. <el-option v-for="item in category_list_v2" :key="item.id" :label="item.name" :value="item.id"></el-option>
  47. </el-select>
  48. </el-form-item>
  49. <el-form-item>
  50. <el-select v-model="search_form.id_v3" placeholder="请选择三级分类" clearable>
  51. <el-option v-for="item in category_list_v3" :key="item.id" :label="item.name" :value="item.id"></el-option>
  52. </el-select>
  53. </el-form-item>
  54. <el-form-item label="价格区间" prop="">
  55. <el-input v-model="search_form.mini_price" placeholder="最低价"
  56. style="width:150px;"></el-input>
  57. <el-input v-model="search_form.highest_price" placeholder="最高价"
  58. style="width:150px;"></el-input>
  59. </el-form-item>
  60. <el-form-item label="商品类型" prop="leader_name">
  61. <el-checkbox v-model.number="search_form.is_new" :true-label="1" :false-label="0">新品</el-checkbox>
  62. <el-checkbox v-model.number="search_form.is_hot" :true-label="1" :false-label="0">热卖</el-checkbox>
  63. <el-checkbox v-model.number="search_form.is_recommand" :true-label="1" :false-label="0">推荐</el-checkbox>
  64. <el-checkbox v-model.number="search_form.is_discount" :true-label="1" :false-label="0">促销</el-checkbox>
  65. </el-form-item>
  66. <a href="#">
  67. <el-button type="primary" icon="el-icon-search" @click="search(1)">搜索</el-button>
  68. </a>
  69. </el-col>
  70. </el-row>
  71. </el-form>
  72. </div>
  73. <div class="table-list">
  74. <div style="margin-left:10px;">
  75. <el-checkbox v-model.number="is_all_choose" :true-label="1" :false-label="0" @change="allChoose">[[is_all_choose==1?'全不选':'全选']]</el-checkbox>
  76. <el-button size="small" @click="batchPutAway(1)">批量上架</el-button>
  77. <el-button size="small" @click="batchPutAway(0)">批量下架</el-button>
  78. <el-button size="small" @click="batchDestroy">批量删除</el-button>
  79. </div>
  80. <div>
  81. <template>
  82. <!-- 表格start -->
  83. <el-table :data="goods_list" style="width: 100%" :class="table_loading==true?'loading-height':''" v-loading="table_loading">
  84. <el-table-column prop="id" label="选择" width="60" align="center">
  85. <template slot-scope="scope">
  86. <el-checkbox v-model.number="scope.row.is_choose" :true-label="1" :false-label="0" @change="oneChange(scope.row)"></el-checkbox>
  87. </template>
  88. </el-table-column>
  89. <el-table-column prop="id" label="ID" width="70" align="center"></el-table-column>
  90. </el-table-column>
  91. <el-table-column prop="member_name" label="排序" max-width="80" align="center">
  92. <template slot-scope="scope">
  93. <el-popover class="item" placement="top" effect="light">
  94. <div style="text-align:center;">
  95. <el-input v-model="change_sort" size="small" style="width:100px;"></el-input>
  96. <el-button size="small" @click="confirmChangeSort(scope.row.id)">确定</el-button>
  97. </div>
  98. <a slot="reference" >
  99. <i class="el-icon-edit edit-i" title="点击编辑排序" @click="editTitle(scope.$index,'sort')"></i>
  100. </a>
  101. </el-popover>
  102. [[scope.row.display_order]]
  103. </template>
  104. </el-table-column>
  105. <el-table-column prop="total" label="商品" width="60" align="center">
  106. <template slot-scope="scope">
  107. <img :src="scope.row.thumb" style="width:50px;height:50px;">
  108. </template>
  109. </el-table-column>
  110. <el-table-column prop="down_time" label="" min-width="180" align="left" class="edit-cell">
  111. <template slot-scope="scope">
  112. <el-popover class="item" placement="top" effect="light">
  113. <div style="text-align:center;">
  114. <div style="text-align:left;margin-bottom:10px;font-weight:900">修改商品标题</div>
  115. <el-input v-model="change_title" style="width:400px" size="small"></el-input>
  116. <el-button size="small" @click="confirmChange(scope.row.id,'title')">确定</el-button>
  117. </div>
  118. <a slot="reference">
  119. <i class="el-icon-edit edit-i" title="点击编辑" @click="editTitle(scope.$index,'title')"></i>
  120. </a>
  121. </el-popover>
  122. [[scope.row.title]]
  123. </template>
  124. </el-table-column>
  125. <el-table-column prop="start_price" label="起拍价" max-width="80" align="center">
  126. <template slot-scope="scope">
  127. <el-popover class="item" placement="top" effect="light" :disabled="scope.row.has_option==1">
  128. <div style="text-align:center;">
  129. <el-input v-model="start_price" size="small" style="width:100px;"></el-input>
  130. <el-button size="small" @click="confirmChangeAuctionPrice(scope.row.id,'start_price')">确定</el-button>
  131. </div>
  132. <a slot="reference" >
  133. <i class="el-icon-edit edit-i" :title="scope.row.has_option==1?'多规格不支持快速修改':'点击编辑'" @click="editTitle(scope.$index,'start_price')"></i>
  134. </a>
  135. </el-popover>
  136. ¥[[scope.row.auction_goods.start_price]]
  137. </template>
  138. </el-table-column>
  139. <el-table-column prop="mini_markup" label="最低加价" max-width="80" align="center">
  140. <template slot-scope="scope">
  141. <el-popover class="item" placement="top" effect="light" :disabled="scope.row.has_option==1">
  142. <div style="text-align:center;">
  143. <el-input v-model="mini_markup" size="small" style="width:100px;"></el-input>
  144. <el-button size="small" @click="confirmChangeAuctionPrice(scope.row.id,'mini_markup')">确定</el-button>
  145. </div>
  146. <a slot="reference" >
  147. <i class="el-icon-edit edit-i" :title="scope.row.has_option==1?'多规格不支持快速修改':'点击编辑'" @click="editTitle(scope.$index,'mini_markup')"></i>
  148. </a>
  149. </el-popover>
  150. ¥[[scope.row.auction_goods.mini_markup]]
  151. </template>
  152. </el-table-column>
  153. <el-table-column prop="mini_deal" label="最低成交价" max-width="80" align="center">
  154. <template slot-scope="scope">
  155. <el-popover class="item" placement="top" effect="light" :disabled="scope.row.has_option==1">
  156. <div style="text-align:center;">
  157. <el-input v-model="mini_deal" size="small" style="width:100px;"></el-input>
  158. <el-button size="small" @click="confirmChangeAuctionPrice(scope.row.id,'mini_deal')">确定</el-button>
  159. </div>
  160. <a slot="reference" >
  161. <i class="el-icon-edit edit-i" :title="scope.row.has_option==1?'多规格不支持快速修改':'点击编辑'" @click="editTitle(scope.$index,'mini_deal')"></i>
  162. </a>
  163. </el-popover>
  164. ¥[[scope.row.auction_goods.mini_deal]]
  165. </template>
  166. </el-table-column>
  167. <el-table-column prop="auctioneer" label="会员" width="70" align="center">
  168. <template slot-scope="scope">
  169. [[scope.row.member.nickname]]
  170. <br/>
  171. [[scope.row.member.realname]]
  172. <br/>
  173. [[scope.row.member.mobile]]
  174. </template>
  175. </el-table-column>
  176. <el-table-column label="状态" prop="status_message" align="center">
  177. <template slot-scope="scope">
  178. [[scope.row.status?'上架':'下架']]
  179. <el-switch v-model="scope.row.status" :active-value="1" :inactive-value="0" @change="putAway(scope.row.id,scope.$index)"></el-switch>
  180. </template>
  181. </el-table-column>
  182. <el-table-column label="操作" width="300" align="center">
  183. <template slot-scope="scope">
  184. <div class="table-option">
  185. <el-popover class="item" placement="left" effect="light" trigger="hover">
  186. <div style="text-align:center;">
  187. <img :src="img" alt="" style="margin:10px;width:100px;height:100px;">
  188. </div>
  189. <a slot="reference" @mouseover="listCode(scope.$index)">推广链接</a>
  190. </el-popover>&nbsp;&nbsp;
  191. <a :href="'{{ yzWebFullUrl('plugin.auction.admin.auction.copy', array('gid' => '')) }}'+[[scope.row.id]]">
  192. 复制商品
  193. </a>
  194. &nbsp;&nbsp;
  195. <a target="_blank" :href="'{{ yzWebFullUrl('plugin.auction.admin.auction.edit-auction-goods', array('id' => '')) }}'+[[scope.row.id]]">
  196. 编辑
  197. </a>&nbsp;&nbsp;
  198. <a @click="delOne(scope.row.id)">
  199. 删除
  200. </a>&nbsp;&nbsp;
  201. <a @click="copyList(scope.row.id)">
  202. 复制链接
  203. </a>
  204. <div>
  205. <input v-model="scope.row.link" :ref="'list'+scope.row.id" style="position:absolute;opacity:0;height:1px;" />
  206. </div>
  207. </div>
  208. <div>
  209. <el-checkbox border size="mini" v-model.number="scope.row.is_new" :true-label="1" :false-label="0" @change="setProperty(scope.row.id,scope.$index,'is_new')">新品</el-checkbox>
  210. <el-checkbox border size="mini" v-model.number="scope.row.is_hot" :true-label="1" :false-label="0" @change="setProperty(scope.row.id,scope.$index,'is_hot')">热卖</el-checkbox>
  211. <el-checkbox border size="mini" v-model.number="scope.row.is_recommand" :true-label="1" :false-label="0" @change="setProperty(scope.row.id,scope.$index,'is_recommand')">推荐</el-checkbox>
  212. <el-checkbox border size="mini" v-model.number="scope.row.is_discount" :true-label="1" :false-label="0" @change="setProperty(scope.row.id,scope.$index,'is_discount')">促销</el-checkbox>
  213. </div>
  214. </template>
  215. </el-table-column>
  216. </el-table>
  217. <!-- 表格end -->
  218. </template>
  219. </div>
  220. </div>
  221. </div>
  222. <!-- 分页 -->
  223. <div class="vue-page" v-show="total>1">
  224. <el-row>
  225. <el-col align="right">
  226. <el-pagination layout="prev, pager, next,jumper" @current-change="search" :total="total" :page-size="per_size" :current-page="current_page" background v-loading="loading"></el-pagination>
  227. </el-col>
  228. </el-row>
  229. </div>
  230. </div>
  231. </template>
  232. </div>
  233. </div>
  234. <script src="{{resource_get('static/js/qrcode.min.js')}}"></script>
  235. <script>
  236. var app = new Vue({
  237. el:"#auction",
  238. delimiters: ['[[', ']]'],
  239. data() {
  240. return{
  241. id:"",
  242. img:"",//二维码
  243. is_all_choose:0,//是否全选
  244. goods_list:[],//商品列表
  245. change_title:"",//修改标题弹框赋值
  246. start_price:"",//修改价格弹框赋值
  247. mini_markup:"",//修改价格弹框赋值
  248. mini_deal:"",//修改价格弹框赋值
  249. change_stock:"",//修改库存弹框赋值
  250. change_sort:"",//修改排序弹框赋值
  251. all_loading:false,
  252. status_list:[
  253. {id:'',name:'全部状态'},
  254. {id:0,name:'下架'},
  255. {id:1,name:'上架'},
  256. ],
  257. authentication_type:[
  258. {id:'',name:'全部状态'},
  259. {id:1,name:'已认证'},
  260. {id:2,name:'未认证'},
  261. ],
  262. brands_list:[],//品牌名称
  263. category_list:[],
  264. category_list_v2:[],
  265. category_list_v3:[],
  266. search_form:{
  267. id_v1:'',
  268. id_v2:'',
  269. id_v3:''
  270. },
  271. form:{},
  272. level_list:[],
  273. loading:false,
  274. table_loading:false,
  275. rules:{},
  276. //分页
  277. total:0,
  278. per_size:0,
  279. current_page:0,
  280. rules:{},
  281. }
  282. },
  283. created() {
  284. this.getData();
  285. },
  286. methods: {
  287. getData() {
  288. var that = this;
  289. that.table_loading = true;
  290. that.$http.post("{!! yzWebFullUrl('plugin.auction.admin.auction.goods-list') !!}").then(response => {
  291. if(response.data.result==1){
  292. that.goods_list = response.data.data.list.data;
  293. let arr =[];
  294. that.goods_list.forEach((item,index) => {
  295. item.title = that.escapeHTML(item.title)
  296. arr.push(Object.assign({},item,{is_choose:0}))//是否选中
  297. });
  298. that.goods_list=arr;
  299. that.total = response.data.data.list.total;
  300. that.current_page = response.data.data.list.current_page;
  301. that.per_size = response.data.data.list.per_page;
  302. that.brands_list = response.data.data.brands;
  303. that.category_list = response.data.data.category;
  304. }
  305. else{
  306. that.$message.error(response.data.msg);
  307. }
  308. that.table_loading = false;
  309. }),function(res){
  310. that.table_loading = false;
  311. };
  312. },
  313. // 一级分类改变
  314. changeV1(){
  315. this.search_form.id_v2 = "";
  316. this.search_form.id_v3 = "";
  317. this.category_list_v2 = [];
  318. this.category_list_v3 = [];
  319. this.category_list.find(item => {
  320. if(item.id == this.search_form.id_v1) {
  321. this.category_list_v2 = item.childrens;
  322. }
  323. });
  324. },
  325. // 二级分类改变
  326. changeV2(){
  327. this.search_form.id_v3 = "";
  328. this.category_list_v3 = [];
  329. this.category_list_v2.find(item => {
  330. if(item.id == this.search_form.id_v2) {
  331. this.category_list_v3 = item.childrens;
  332. }
  333. });
  334. },
  335. // 搜索、分页
  336. search(page) {
  337. var that = this;
  338. // 商品类型
  339. let product_attr = [];
  340. if(that.search_form.is_new == 1){
  341. product_attr.push('is_new')
  342. }
  343. if(that.search_form.is_hot == 1){
  344. product_attr.push('is_hot')
  345. }
  346. if(that.search_form.is_recommand == 1){
  347. product_attr.push('is_recommand')
  348. }
  349. if(that.search_form.is_discount == 1){
  350. product_attr.push('is_discount')
  351. }
  352. let json = {
  353. page:page,
  354. search:{
  355. goods_id:that.search_form.goods_id,
  356. keyword:that.search_form.keyword,
  357. auctioneer:that.search_form.auctioneer,
  358. authentication:that.search_form.authentication,
  359. brand_id:that.search_form.brand_id,
  360. status:that.search_form.status,
  361. mini_price: that.search_form.mini_price,
  362. highest_price: that.search_form.highest_price,
  363. product_attr:product_attr,//商品类型,
  364. auction_goods:that.search_form.auction_goods,
  365. },
  366. category:{
  367. parentid:that.search_form.id_v1,
  368. childid:that.search_form.id_v2,
  369. thirdid:that.search_form.id_v3,
  370. }
  371. };
  372. that.table_loading = true;
  373. that.$http.post("{!! yzWebFullUrl('plugin.auction.admin.auction.search-goods') !!}",json).then(response => {
  374. if(response.data.result==1){
  375. let arr = [];
  376. that.goods_list = response.data.data.data;
  377. that.goods_list.forEach((item,index) => {
  378. item.title = that.escapeHTML(item.title)
  379. arr.push(Object.assign({},item,{is_choose:0}))//是否选中
  380. });
  381. that.goods_list = arr;
  382. //console.log(that.goods_list);
  383. that.total = response.data.data.total;
  384. that.current_page = response.data.data.current_page;
  385. that.per_size = response.data.data.per_page;
  386. } else {
  387. that.$message.error(response.data.msg);
  388. }
  389. that.table_loading = false;
  390. }),function(res){
  391. that.table_loading = false;
  392. };
  393. },
  394. qrcodeScan (url) {//生成二维码
  395. let qrcode = new QRCode('qrcode', {
  396. width: 100, // 二维码宽度
  397. height: 100, // 二维码高度
  398. render: 'image',
  399. text: url
  400. });
  401. var data = $("canvas")[$("canvas").length-1].toDataURL().replace("image/png", "image/octet-stream;");
  402. this.img = data;
  403. },
  404. // 活动二维码
  405. listCode(index) {
  406. this.qrcodeScan(this.goods_list[index].link);
  407. },
  408. // 复制活动链接
  409. copyList(index) {
  410. that = this;
  411. let Url = that.$refs['list'+index];
  412. Url.select(); // 选择对象
  413. document.execCommand("Copy",false);
  414. that.$message({message:"复制成功!",type:"success"});
  415. },
  416. // 单个选择
  417. oneChange(item) {
  418. let that = this;
  419. let is_all = 0;
  420. that.goods_list.some((item,index) => {
  421. if(item.is_choose == 1) {
  422. is_all = 1;
  423. }
  424. else {
  425. is_all = 0;
  426. return true;
  427. }
  428. })
  429. that.is_all_choose = is_all;
  430. },
  431. // 全选
  432. allChoose() {
  433. let that = this;
  434. let status = 0;
  435. if(that.is_all_choose == 1){
  436. status = 1;
  437. }
  438. else{
  439. status = 0;
  440. }
  441. that.goods_list.forEach((item,index) => {
  442. item.is_choose = status;
  443. })
  444. },
  445. // 上架、下架
  446. putAway(id,index) {
  447. var that = this;
  448. that.table_loading = true;
  449. let data = that.goods_list[index].status;
  450. let json = {id:id,type:'status',data:data};
  451. that.$http.post("{!! yzWebFullUrl('plugin.auction.admin.auction.set-property') !!}",json).then(response => {
  452. if(response.data.result==1){
  453. that.$message.success('操作成功!');
  454. }
  455. else{
  456. that.$message.error(response.data.msg);
  457. if( that.goods_list[index].status == 0) {
  458. that.goods_list[index].status = 1
  459. }
  460. else if(that.goods_list[index].status == 1) {
  461. that.goods_list[index].status = 0
  462. }
  463. }
  464. that.table_loading = false;
  465. }),function(res){
  466. console.log(res);
  467. that.table_loading = false;
  468. };
  469. },
  470. // 批量上架、下架
  471. batchPutAway(data) {
  472. var that = this;
  473. that.table_loading = true;
  474. let ids = [];
  475. that.goods_list.forEach((item,index) => {
  476. if(item.is_choose == 1){
  477. ids.push(item.id);
  478. }
  479. })
  480. let json = {data:data,ids:ids}
  481. that.$http.post("{!! yzWebFullUrl('plugin.auction.admin.auction.batch-set-property') !!}",json).then(response => {
  482. if(response.data.result==1){
  483. that.$message.success('操作成功!');
  484. that.is_all_choose = 0;
  485. that.search(1);
  486. }
  487. else{
  488. that.$message.error(response.data.msg);
  489. }
  490. that.table_loading = false;
  491. }),function(res){
  492. console.log(res);
  493. that.table_loading = false;
  494. };
  495. },
  496. // 单个删除
  497. delOne(id) {
  498. var that = this;
  499. that.$confirm('确定删除吗', '提示', {confirmButtonText: '确定',cancelButtonText: '取消',type: 'warning'}).then(() => {
  500. that.table_loading = true;
  501. that.$http.post("{!! yzWebFullUrl('plugin.auction.admin.auction.delete-goods') !!}",{id:id}).then(response => {
  502. console.log(response);
  503. if(response.data.result==1){
  504. that.$message.success("删除成功!");
  505. that.search(1);
  506. }
  507. else{
  508. that.$message.error(response.data);
  509. }
  510. that.table_loading = false;
  511. }),function(res){
  512. console.log(res);
  513. that.table_loading = false;
  514. };
  515. }).catch(() => {
  516. this.$message({type: 'info',message: '已取消修改'});
  517. });
  518. },
  519. // 批量删除
  520. batchDestroy() {
  521. var that = this;
  522. that.$confirm('确定删除吗', '提示', {confirmButtonText: '确定',cancelButtonText: '取消',type: 'warning'}).then(() => {
  523. that.table_loading = true;
  524. let ids = [];
  525. that.goods_list.forEach((item,index) => {
  526. if(item.is_choose == 1){
  527. ids.push(item.id);
  528. }
  529. })
  530. let json = {ids:ids}
  531. that.$http.post("{!! yzWebFullUrl('plugin.auction.admin.auction.batch-delete-goods') !!}",json).then(response => {
  532. console.log(response);
  533. if(response.data.result==1){
  534. that.$message.success('操作成功!');
  535. that.is_all_choose = 0;
  536. that.search(1);
  537. }
  538. else{
  539. that.$message.error(response.data.msg);
  540. }
  541. that.table_loading = false;
  542. }),function(res){
  543. console.log(res);
  544. that.table_loading = false;
  545. };
  546. }).catch(() => {
  547. this.$message({type: 'info',message: '已取消修改'});
  548. });
  549. },
  550. // 新品、热卖、推荐、促销、
  551. setProperty(id,index,type) {
  552. var that = this;
  553. that.table_loading = true;
  554. console.log(that.goods_list[index][type])
  555. let data = that.goods_list[index][type];
  556. let json = {id:id,type:type,data:data};
  557. that.$http.post("{!! yzWebFullUrl('goods.goods.setProperty') !!}",json).then(response => {
  558. console.log(response);
  559. if(response.data.result==1){
  560. that.$message.success('操作成功!');
  561. }
  562. else{
  563. that.$message.error(response.data.msg);
  564. that.goods_list[index][type] == 1 ? 0 : 1;
  565. }
  566. that.table_loading = false;
  567. }),function(res){
  568. console.log(res);
  569. that.table_loading = false;
  570. };
  571. },
  572. // 编辑商品标题
  573. editTitle(index,type) {
  574. let that = this;
  575. if(type == 'title') {
  576. that.change_title = "";
  577. that.change_title = that.goods_list[index].title;
  578. }
  579. if(type == 'start_price') {
  580. if(that.goods_list[index].has_option == 1) {
  581. that.$message.error('多规格不支持快速修改');
  582. return false;
  583. }
  584. that.start_price = "";
  585. that.start_price = that.goods_list[index].start_price;
  586. }
  587. if(type == 'mini_markup') {
  588. if(that.goods_list[index].has_option == 1) {
  589. that.$message.error('多规格不支持快速修改');
  590. return false;
  591. }
  592. that.mini_markup = "";
  593. that.mini_markup = that.goods_list[index].mini_markup;
  594. }
  595. if(type == 'mini_deal') {
  596. if(that.goods_list[index].has_option == 1) {
  597. that.$message.error('多规格不支持快速修改');
  598. return false;
  599. }
  600. that.mini_deal = "";
  601. that.mini_deal = that.goods_list[index].mini_deal;
  602. }
  603. if(type == 'stock') {
  604. if(that.goods_list[index].has_option == 1) {
  605. that.$message.error('多规格不支持快速修改');
  606. return false;
  607. }
  608. that.change_stock = "";
  609. that.change_stock = that.goods_list[index].stock;
  610. }
  611. if(type == 'sort') {
  612. that.change_sort = "";
  613. that.change_sort = that.goods_list[index].display_order;
  614. }
  615. },
  616. // 确认修改标题、价格、库存
  617. confirmChange(id,type) {
  618. let that = this;
  619. let value = '';
  620. if(type == 'title'){
  621. value = that.change_title;
  622. if(that.change_title == ''){
  623. that.$message.error('标题不能为空');
  624. return false;
  625. }
  626. }
  627. if(type == 'stock'){
  628. value = that.change_stock;
  629. if(!(/^\d+$/.test(that.change_stock))){
  630. that.$message.error('请输入正确数字');
  631. return false;
  632. }
  633. }
  634. let json = {
  635. id:id,
  636. type:type,
  637. value:value,
  638. };
  639. that.table_loading = true;
  640. that.$http.post("{!! yzWebFullUrl('goods.goods.change') !!}",json).then(response => {
  641. console.log(response);
  642. if(response.data.result==1){
  643. that.$message.success('操作成功!');
  644. if (document.all) {
  645. document.getElementById('auction').click();
  646. }
  647. else {// 其它浏览器
  648. var e = document.createEvent('MouseEvents')
  649. e.initEvent('click', true, true)
  650. document.getElementById('auction').dispatchEvent(e)
  651. }
  652. that.search(1);
  653. }
  654. else{
  655. that.$message.error(response.data.msg);
  656. }
  657. that.table_loading = false;
  658. }),function(res){
  659. console.log(res);
  660. that.table_loading = false;
  661. };
  662. },
  663. // 确认修改标题、价格、库存
  664. confirmChangeAuctionPrice(id,type) {
  665. let that = this;
  666. let value = '';
  667. if(type == 'start_price'){
  668. value = that.start_price;
  669. if(!(/^\d+(\.\d+)?$/.test(that.start_price))){
  670. that.$message.error('请输入正确价格');
  671. return false;
  672. }
  673. }
  674. if(type == 'mini_markup'){
  675. value = that.mini_markup;
  676. if(!(/^\d+(\.\d+)?$/.test(that.mini_markup))){
  677. that.$message.error('请输入正确价格');
  678. return false;
  679. }
  680. }
  681. if(type == 'mini_deal'){
  682. value = that.mini_deal;
  683. if(!(/^\d+(\.\d+)?$/.test(that.mini_deal))){
  684. that.$message.error('请输入正确价格');
  685. return false;
  686. }
  687. }
  688. let json = {
  689. id:id,
  690. type:type,
  691. value:value,
  692. };
  693. that.table_loading = true;
  694. that.$http.post("{!! yzWebFullUrl('plugin.auction.admin.auction.edit-price') !!}",json).then(response => {
  695. console.log(response);
  696. if(response.data.result==1){
  697. that.$message.success('操作成功!');
  698. if (document.all) {
  699. document.getElementById('auction').click();
  700. }
  701. else {// 其它浏览器
  702. var e = document.createEvent('MouseEvents')
  703. e.initEvent('click', true, true)
  704. document.getElementById('auction').dispatchEvent(e)
  705. }
  706. that.search(1);
  707. }
  708. else{
  709. //console.log(response.data);
  710. that.$message.error(response.data.msg);
  711. }
  712. that.table_loading = false;
  713. }),function(res){
  714. console.log(res);
  715. that.table_loading = false;
  716. };
  717. },
  718. // 确认修改排序
  719. confirmChangeSort(id) {
  720. let that = this;
  721. if(!(/^\d+$/.test(that.change_sort))){
  722. that.$message.error('请输入正确数字');
  723. return false;
  724. }
  725. that.table_loading = true;
  726. let json = {id:id,value:that.change_sort};
  727. that.$http.post("{!! yzWebFullUrl('goods.goods.displayorder') !!}",json).then(response => {
  728. console.log(response);
  729. if(response.data.result==1){
  730. that.$message.success('操作成功!');
  731. // that.$refs.search_form.click();
  732. if (document.all) {
  733. document.getElementById('auction').click();
  734. }
  735. else {// 其它浏览器
  736. var e = document.createEvent('MouseEvents')
  737. e.initEvent('click', true, true)
  738. document.getElementById('auction').dispatchEvent(e)
  739. }
  740. that.search(1);
  741. }
  742. else{
  743. that.$message.error(response.data.msg);
  744. }
  745. that.table_loading = false;
  746. }),function(res){
  747. console.log(res);
  748. that.table_loading = false;
  749. };
  750. },
  751. // 字符转义
  752. escapeHTML(a) {
  753. a = "" + a;
  754. return a.replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, "\"").replace(/&apos;/g, "'");;
  755. },
  756. },
  757. })
  758. </script>
  759. @endsection