stock-log.php 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813
  1. <?php
  2. /**
  3. * @link:http://www.goodmall.com/
  4. * @copyright: Copyright (c) 2020
  5. * Created by PhpStorm
  6. * Author: ganxiaohao
  7. * Date: 2020-05-08
  8. * Time: 16:11
  9. */
  10. use common\helpers\ComponentHelper;
  11. $diyPath = dirname(__DIR__) . '/components';
  12. ComponentHelper::loadComponentView('stock-goods-edit', $diyPath);
  13. ComponentHelper::loadComponentView('com-export-dialog', '@backend/views/components/common');
  14. ?>
  15. <div id="app" v-cloak>
  16. <el-card shadow="never" body-style="background-color: #f3f3f3;padding: 10px 0 0;" style="min-width: 1300px;">
  17. <div slot="header" class="title">
  18. <span>库存明细</span>
  19. <!-- <div style="float: right; margin: -5px 0">
  20. <el-button type="primary" @click="editClick" size="small">添加库存商品</el-button>
  21. </div> -->
  22. <com-export-dialog :field_list='exportList' :action_url="export_url" :params="searchData" ></com-export-dialog>
  23. </div>
  24. <div class="table-body">
  25. <el-tabs v-model="activeName" type="card" @tab-click="handleClick">
  26. <el-tab-pane label="扣减库存明细列表" name="first">
  27. <div class="head" style="display: flex;margin-bottom: 20px;">
  28. <el-input clearable style="width: 130px;margin-right: 20px;" size="small" type="text" @keyup.enter.native="searchFun1" v-model="search1.order_id" placeholder="请输入订单id"></el-input>
  29. <el-input clearable style="width: 200px;margin-right: 20px;" size="small" type="text" @keyup.enter.native="searchFun1" v-model="search1.order_no" placeholder="请输入订单编号"></el-input>
  30. <el-input clearable style="width: 170px;margin-right: 20px;" size="small" type="text" @keyup.enter.native="searchFun1" v-model="search1.keyword" placeholder="请输入代理商id"></el-input>
  31. <el-input clearable style="width: 170px;margin-right: 20px;" size="small" type="text" @keyup.enter.native="searchFun1" v-model="search1.mobile" placeholder="手机号"></el-input>
  32. <el-input clearable style="width: 200px;margin-right: 20px;" size="small" type="text" @keyup.enter.native="searchFun1" v-model="search1.goods_name" placeholder="请输入商品名称"></el-input>
  33. <el-select clearable size="small" v-model="search1.changes_type" @change="searchFun1" class="select" placeholder="请选择库存扣减类型" style="margin-right: 20px;"><!-- @change='toSearch' -->
  34. <!-- <el-option key="all" label="全部等级" value=""></el-option> -->
  35. <el-option :key="index" :label="item.desc" :value="item.value" v-for="(item, index) in deductionList"></el-option>
  36. </el-select>
  37. <el-date-picker
  38. style="margin-right: 20px;"
  39. size="small"
  40. v-model="selectData"
  41. type="daterange"
  42. value-format="yyyy-MM-dd"
  43. range-separator="至"
  44. start-placeholder="开始日期"
  45. end-placeholder="结束日期">
  46. </el-date-picker>
  47. <el-button type="primary" icon="el-icon-search" style="padding: 0 10px !important;" @click="searchFun1">搜索</el-button>
  48. </div>
  49. <el-table
  50. size="small"
  51. :data="list"
  52. style="width: 100%"
  53. v-loading="listLoading">
  54. <el-table-column
  55. label="代理商"
  56. min-width="200"
  57. >
  58. <template slot-scope="scope">
  59. <div class="table-info-img-text">
  60. <el-image class="default-avatar" :src="scope.row.agent_user_avatar_url" style="width: 50px;height: 50px;">
  61. <div slot="error" class="image-slot">
  62. <com-image src="resources/img/mall/default_avatar_url.png" style="width: 50px;height: 50px;"></com-image>
  63. </div>
  64. </el-image>
  65. <div class="table-info-text" style="width: 150px;">
  66. <div style="color:#000;">ID:{{scope.row.agent_user_id}}</div>
  67. <div style="color:#000;">昵称:{{scope.row.agent_user_nickname}}</div>
  68. <div style="color:#000;">{{scope.row.agent_user_mobile}}</div>
  69. </div>
  70. </div>
  71. </template>
  72. </el-table-column>
  73. <el-table-column
  74. prop="goods_id"
  75. align="center"
  76. label="商品id">
  77. </el-table-column>
  78. <el-table-column
  79. label="商品名称"
  80. min-width="150"
  81. >
  82. <template slot-scope="scope">
  83. <div style="display: flex;align-items: center;">
  84. <img v-if="scope.row.goods.cover_pic" :src="scope.row.goods.cover_pic" style="width: 40px;height: 40px;display: block;margin-right: 5px;" />
  85. <div style="text-align: left;line-height: 16px;">{{scope.row.goods.goods_name}}</div>
  86. </div>
  87. </template>
  88. </el-table-column>
  89. <el-table-column
  90. prop="num"
  91. label="扣减库存数"
  92. align="center"
  93. min-width="100"
  94. >
  95. <template slot-scope="scope">
  96. -{{scope.row.num}}
  97. </template>
  98. </el-table-column>
  99. <!-- <el-table-column
  100. prop="user_nickname"
  101. label="对方用户"
  102. min-width="150"
  103. align="center"
  104. >
  105. <template slot-scope="scope">
  106. <div style="display: flex;align-items: center;justify-content: center;">
  107. <img v-if="scope.row.user_avatar_url" :src="scope.row.user_avatar_url" style="width: 40px;height: 40px;display: block;margin-right: 5px;" />
  108. <div>{{scope.row.user_nickname}}</div>
  109. </div>
  110. </template>
  111. </el-table-column> -->
  112. <el-table-column
  113. prop="id"
  114. align="center"
  115. label="扣减库存类型"
  116. min-width="100">
  117. <template slot-scope="scope">
  118. <el-tag>{{changeTypeMap[scope.row.changes_type]}}</el-tag>
  119. </template>
  120. </el-table-column>
  121. <el-table-column
  122. label="补货下级"
  123. min-width="200"
  124. >
  125. <template slot-scope="scope">
  126. <div class="table-info-img-text" v-if="scope.row.from_user && scope.row.from_user.length > 0" v-for="item in scope.row.from_user">
  127. <el-image class="default-avatar" :src="item.avatar_url" style="width: 50px;height: 50px;">
  128. <div slot="error" class="image-slot">
  129. <com-image src="resources/img/mall/default_avatar_url.png" style="width: 50px;height: 50px;"></com-image>
  130. </div>
  131. </el-image>
  132. <div class="table-info-text" style="width: 100px;">
  133. <div style="color:#000;">ID:{{item.id}}</div>
  134. <div style="color:#000;">昵称:{{item.nickname}}</div>
  135. </div>
  136. </div>
  137. </template>
  138. </el-table-column>
  139. <el-table-column
  140. prop="order_id"
  141. align="center"
  142. label="订单id"
  143. min-width="80">
  144. </el-table-column>
  145. <el-table-column
  146. prop="order_no"
  147. align="center"
  148. label="订单编号"
  149. min-width="180">
  150. </el-table-column>
  151. <el-table-column
  152. prop="created_at"
  153. align="center"
  154. label="时间"
  155. min-width="150">
  156. <template slot-scope="scope">
  157. {{formatTime(scope.row.created_at)}}
  158. </template>
  159. </el-table-column>
  160. <!-- <el-table-column
  161. align="center"
  162. label="操作"
  163. min-width="200">
  164. <template slot-scope="scope">
  165. <el-button type="primary" size="mini" @click="seeDetail">查看详情</el-button>
  166. </template>
  167. </el-table-column> -->
  168. </el-table>
  169. <!-- 代理库存页面 end -->
  170. <div style="text-align: right;margin: 20px 0;">
  171. <el-pagination
  172. @current-change="pagination"
  173. background
  174. layout="prev, pager, next"
  175. :page-count="pageCount">
  176. </el-pagination>
  177. </div>
  178. </el-tab-pane>
  179. <el-tab-pane label="增加库存明细列表" name="second">
  180. <div class="head" style="display: flex;margin-bottom: 20px;">
  181. <el-input clearable style="width: 130px;margin-right: 20px;" size="small" type="text" @keyup.enter.native="searchFun2" v-model="search2.order_id" placeholder="请输入订单id"></el-input>
  182. <el-input clearable style="width: 200px;margin-right: 20px;" size="small" type="text" @keyup.enter.native="searchFun2" v-model="search2.order_no" placeholder="请输入订单编号"></el-input>
  183. <el-input clearable style="width: 170px;margin-right: 20px;" size="small" type="text" @keyup.enter.native="searchFun2" v-model="search2.keyword" placeholder="请输入代理商id"></el-input>
  184. <el-input clearable style="width: 170px;margin-right: 20px;" size="small" type="text" @keyup.enter.native="searchFun1" v-model="search2.mobile" placeholder="手机号"></el-input>
  185. <el-input clearable style="width: 200px;margin-right: 20px;" size="small" type="text" @keyup.enter.native="searchFun2" v-model="search2.goods_name" placeholder="请输入商品名称"></el-input>
  186. <el-select clearable size="small" v-model="search2.changes_type" @change="searchFun2" class="select" placeholder="请选择库存增加类型" style="margin-right: 20px;"><!-- @change='toSearch' -->
  187. <el-option :key="index" :label="item.desc" :value="item.value" v-for="(item, index) in increaseList"></el-option>
  188. </el-select>
  189. <el-date-picker
  190. style="margin-right: 20px;"
  191. size="small"
  192. v-model="selectData2"
  193. type="daterange"
  194. value-format="yyyy-MM-dd"
  195. range-separator="至"
  196. start-placeholder="开始日期"
  197. end-placeholder="结束日期">
  198. </el-date-picker>
  199. <el-button type="primary" icon="el-icon-search" style="padding: 0 10px !important;" @click="searchFun2">搜索</el-button>
  200. </div>
  201. <el-table
  202. size="small"
  203. :data="list"
  204. style="width: 100%"
  205. v-loading="listLoading">
  206. <el-table-column
  207. label="代理商"
  208. min-width="200"
  209. >
  210. <template slot-scope="scope">
  211. <div class="table-info-img-text">
  212. <el-image class="default-avatar" :src="scope.row.agent_user_avatar_url" style="width: 50px;height: 50px;">
  213. <div slot="error" class="image-slot">
  214. <com-image src="resources/img/mall/default_avatar_url.png" style="width: 50px;height: 50px;"></com-image>
  215. </div>
  216. </el-image>
  217. <div class="table-info-text" style="width: 100px;">
  218. <div style="color:#000;">ID:{{scope.row.agent_user_id}}</div>
  219. <div style="color:#000;">昵称:{{scope.row.agent_user_nickname}}</div>
  220. <div style="color:#000;">{{scope.row.agent_user_mobile}}</div>
  221. </div>
  222. </div>
  223. </template>
  224. </el-table-column>
  225. <el-table-column
  226. prop="goods_id"
  227. align="center"
  228. label="商品id">
  229. </el-table-column>
  230. <el-table-column
  231. label="商品名称"
  232. min-width="150"
  233. >
  234. <template slot-scope="scope">
  235. <div style="display: flex;align-items: center;">
  236. <img v-if="scope.row.goods.cover_pic" :src="scope.row.goods.cover_pic" style="width: 50px;height: 50px;display: block;margin-right: 5px;" />
  237. <div style="text-align: left;line-height: 16px;">{{scope.row.goods.goods_name}}</div>
  238. </div>
  239. </template>
  240. </el-table-column>
  241. <el-table-column
  242. prop="num"
  243. label="增加库存数量"
  244. align="center"
  245. min-width="100"
  246. >
  247. <template slot-scope="scope">
  248. +{{scope.row.num}}
  249. </template>
  250. </el-table-column>
  251. <!-- <el-table-column
  252. prop="user_nickname"
  253. label="对方用户"
  254. min-width="150"
  255. align="center"
  256. >
  257. <template slot-scope="scope">
  258. <div style="display: flex;align-items: center;justify-content: center;">
  259. <img v-if="scope.row.user_avatar_url" :src="scope.row.user_avatar_url" style="width: 40px;height: 40px;display: block;margin-right: 5px;" />
  260. <div>{{scope.row.user_nickname}}</div>
  261. </div>
  262. </template>
  263. </el-table-column> -->
  264. <el-table-column
  265. prop="id"
  266. align="center"
  267. label="增加库存类型"
  268. min-width="150">
  269. <template slot-scope="scope">
  270. <el-tag>{{changeTypeMap[scope.row.changes_type]}}</el-tag>
  271. </template>
  272. </el-table-column>
  273. <el-table-column
  274. label="补货上级"
  275. min-width="200"
  276. >
  277. <template slot-scope="scope">
  278. <div class="table-info-img-text" v-if="scope.row.from_user && scope.row.from_user.length > 0" v-for="item in scope.row.from_user">
  279. <el-image class="default-avatar" :src="item.avatar_url" style="width: 50px;height: 50px;">
  280. <div slot="error" class="image-slot">
  281. <com-image src="resources/img/mall/default_avatar_url.png" style="width: 50px;height: 50px;"></com-image>
  282. </div>
  283. </el-image>
  284. <div class="table-info-text" style="width: 100px;">
  285. <div style="color:#000;">ID:{{item.id}}</div>
  286. <div style="color:#000;">昵称:{{item.nickname}}</div>
  287. </div>
  288. </div>
  289. </template>
  290. </el-table-column>
  291. <el-table-column
  292. prop="order_id"
  293. align="center"
  294. label="订单id"
  295. min-width="80">
  296. </el-table-column>
  297. <el-table-column
  298. prop="order_no"
  299. align="center"
  300. label="订单编号"
  301. min-width="180">
  302. </el-table-column>
  303. <el-table-column
  304. prop="created_at"
  305. align="center"
  306. label="时间"
  307. min-width="150">
  308. <template slot-scope="scope">
  309. {{formatTime(scope.row.created_at)}}
  310. </template>
  311. </el-table-column>
  312. <!-- <el-table-column
  313. align="center"
  314. label="操作"
  315. min-width="200">
  316. <template slot-scope="scope">
  317. <el-button type="primary" size="mini" @click="seeDetail">查看详情</el-button>
  318. </template>
  319. </el-table-column> -->
  320. </el-table>
  321. <!-- 代理库存页面 end -->
  322. <div style="text-align: right;margin: 20px 0;">
  323. <el-pagination
  324. @current-change="pagination"
  325. background
  326. layout="prev, pager, next"
  327. :page-count="pageCount">
  328. </el-pagination>
  329. </div>
  330. </el-tab-pane>
  331. </el-tabs>
  332. </div>
  333. </el-card>
  334. <stock-goods-edit v-model="edit.show" :edit_row="edit"></stock-goods-edit>
  335. <el-dialog
  336. center
  337. title="库存详情"
  338. :visible.sync="dialogVisible"
  339. width="50%"
  340. >
  341. <el-table
  342. size="small"
  343. :data="tableData2"
  344. style="width: 100%;padding-bottom: 30px;">
  345. <el-table-column
  346. label="商品名称"
  347. >
  348. <template slot-scope="scope">
  349. <div style="display: flex;align-items: center;">
  350. <img :src="scope.row.huiyuan.img" style="width: 35px;height: 35px;display: block;margin-right: 5px;" />
  351. <div>{{scope.row.huiyuan.name}}</div>
  352. </div>
  353. </template>
  354. </el-table-column>
  355. <el-table-column
  356. align="center"
  357. label="拿货价"
  358. >
  359. <template slot-scope="scope">
  360. ¥{{scope.row.id}}
  361. </template>
  362. </el-table-column>
  363. <el-table-column
  364. prop="id"
  365. align="center"
  366. label="库存">
  367. </el-table-column>
  368. </el-table>
  369. </el-dialog>
  370. </div>
  371. <script>
  372. const app = new Vue({
  373. el: '#app',
  374. data() {
  375. return {
  376. edit:{
  377. show:false,
  378. id:0,
  379. },
  380. list: [],
  381. keyword: '',
  382. listLoading: false,
  383. page: 1,
  384. level:1,
  385. pageCount: 0,
  386. condition_type_list: {
  387. 1: '下线用户数',
  388. 2: '累计佣金',
  389. 3: '已提现佣金'
  390. },
  391. price_type_list: {
  392. 1: '%',
  393. 2: '元'
  394. },
  395. dialogVisible:false,
  396. activeName: 'first',
  397. selectData:'',
  398. selectData2:'',
  399. increaseList:[],
  400. deductionList:[],
  401. jiaJianKuncun:[
  402. {
  403. name:'减库存',
  404. level:1
  405. },{
  406. name:'加库存',
  407. level:2
  408. }],
  409. jiaJianKuncunValue:'',
  410. search1:{
  411. order_id:'',
  412. goods_name:'',
  413. start:'',
  414. end:'',
  415. changes_type:'',
  416. keyword:'',
  417. order_no:'',
  418. mobile:'',
  419. },
  420. search2:{
  421. order_id:'',
  422. goods_name:'',
  423. start:'',
  424. end:'',
  425. changes_type:'',
  426. keyword:'',
  427. order_no:'',
  428. mobile:'',
  429. },
  430. tableData2: [{
  431. id:1,
  432. huiyuan:{
  433. img:'http://zhenai.ruinuomei.com/product/5a0bb3d1-cffe-49c7-99d7-b1481c31dc5c',
  434. name:'张三'
  435. },
  436. phone:15219398480,
  437. dengji:"等级1",
  438. pro:[
  439. {
  440. name:'红酒红酒红酒红酒红酒红酒红酒',
  441. price:199.99,
  442. kucun:99
  443. },
  444. {
  445. name:'红酒2',
  446. price:199.99,
  447. kucun:99
  448. },
  449. {
  450. name:'红酒3',
  451. price:199.99,
  452. kucun:99
  453. }
  454. ]
  455. },
  456. {
  457. id:1,
  458. huiyuan:{
  459. img:'http://zhenai.ruinuomei.com/product/5a0bb3d1-cffe-49c7-99d7-b1481c31dc5c',
  460. name:'张三'
  461. },
  462. phone:15219398480,
  463. dengji:"等级1",
  464. pro:[
  465. {
  466. name:'红酒1',
  467. price:199.99,
  468. kucun:99
  469. },
  470. {
  471. name:'红酒2',
  472. price:199.99,
  473. kucun:99
  474. },
  475. {
  476. name:'红酒3',
  477. price:199.99,
  478. kucun:99
  479. }
  480. ]
  481. }],
  482. agentLevelList:[],
  483. exportList: {},
  484. export_url: 'cloud-stock/default/stock-log',
  485. searchData:{},
  486. changeTypeMap:{},
  487. };
  488. },
  489. mounted: function () {
  490. this.getList();
  491. this.getChangesType();
  492. },
  493. methods: {
  494. searchFun1(){
  495. if(this.selectData && this.selectData[0]){
  496. this.search1.start = this.selectData[0];
  497. this.search1.end = this.selectData[1];
  498. }else{
  499. this.search1.start = '';
  500. this.search1.end = '';
  501. }
  502. this.page = 1;
  503. this.getList();
  504. },
  505. searchFun2(){
  506. if(this.selectData2 && this.selectData2[0]){
  507. this.search2.start = this.selectData2[0];
  508. this.search2.end = this.selectData2[1];
  509. }else{
  510. this.search2.start = '';
  511. this.search2.end = '';
  512. }
  513. this.page = 1;
  514. this.getList2();
  515. },
  516. handleClick(tab, event) {
  517. if(this.activeName == "first"){
  518. this.page = 1;
  519. this.pageCount = 0;
  520. this.getList();
  521. }else if(this.activeName == "second"){
  522. this.page = 1;
  523. this.pageCount = 0;
  524. this.getList2();
  525. }
  526. },
  527. search() {
  528. this.page = 1;
  529. this.getList();
  530. },
  531. pagination(currentPage) {
  532. //let self = this;
  533. this.page = currentPage;
  534. if(this.activeName == "first"){
  535. this.getList();
  536. }else if(this.activeName == "second"){
  537. this.getList2();
  538. }
  539. },
  540. getList() {
  541. let self = this;
  542. self.listLoading = true;
  543. //console.log('请求扣减库存明细列表page='+self.page)
  544. //console.log('请求扣减库存明细列表search1='+JSON.stringify(this.search1))
  545. this.searchData = {
  546. log_type: 'sub',
  547. order_id:this.search1.order_id,
  548. goods_name:this.search1.goods_name,
  549. start:this.search1.start,
  550. end:this.search1.end,
  551. changes_type:this.search1.changes_type,
  552. keyword:this.search1.keyword,
  553. order_no:this.search1.order_no,
  554. mobile:this.search1.mobile,
  555. }
  556. request({
  557. params: {
  558. r: 'cloud-stock/default/stock-log',//plugin/cloud_stock/mall/stock-log/get-deduction-list扣减库存明细列表
  559. page:self.page,
  560. limit: 10,
  561. ...this.searchData
  562. },
  563. method: 'get',
  564. }).then(e => {
  565. //console.log('扣减库存明细列表='+JSON.stringify(e))
  566. self.listLoading = false;
  567. if(e.data.code == 0){
  568. self.list = e.data.data.list;
  569. self.changeTypeMap = e.data.data.changeTypeMap;
  570. self.pageCount = e.data.data.page_count;
  571. self.exportList = e.data.data.export_list;
  572. }
  573. }).catch(e => {
  574. console.log(e);
  575. });
  576. },formatTime(timeStamp) {
  577. var date = new Date();
  578. date.setTime(timeStamp * 1000);
  579. var y = date.getFullYear();
  580. var m = date.getMonth() + 1;
  581. m = m < 10 ? ('0' + m) : m;
  582. var d = date.getDate();
  583. d = d < 10 ? ('0' + d) : d;
  584. var h = date.getHours();
  585. h = h < 10 ? ('0' + h) : h;
  586. var minute = date.getMinutes();
  587. var second = date.getSeconds();
  588. minute = minute < 10 ? ('0' + minute) : minute;
  589. second = second < 10 ? ('0' + second) : second;
  590. return y + '-' + m + '-' + d +' '+ h + ':' + minute + ':' + second;
  591. },
  592. getList2(){
  593. let self = this;
  594. self.listLoading = true;
  595. //console.log('增加库存明细列表page='+self.page)
  596. //console.log('增加库存明细列表search2='+JSON.stringify(this.search2))
  597. this.searchData = {
  598. log_type: 'add',
  599. order_id:this.search2.order_id,
  600. goods_name:this.search2.goods_name,
  601. start:this.search2.start,
  602. end:this.search2.end,
  603. changes_type:this.search2.changes_type,
  604. keyword:this.search2.keyword,
  605. order_no:this.search2.order_no,
  606. mobile:this.search2.mobile,
  607. }
  608. request({
  609. params: {
  610. r: 'cloud-stock/default/stock-log',//增加库存明细列表 plugin/cloud_stock/mall/stock-log/get-increase-list
  611. page:self.page,
  612. limit: 10,
  613. ...this.searchData
  614. },
  615. method: 'get',
  616. }).then(e => {
  617. //console.log('增加库存明细列表='+JSON.stringify(e))
  618. self.listLoading = false;
  619. if(e.data.code == 0){
  620. self.list = e.data.data.list;
  621. self.pageCount = e.data.data.page_count;
  622. self.exportList = e.data.data.export_list;
  623. }
  624. }).catch(e => {
  625. console.log(e);
  626. });
  627. },
  628. getChangesType(){
  629. request({
  630. params: {
  631. r: 'cloud-stock/default/get-changes-type-list',//库存变动类型列表 plugin/cloud_stock/mall/stock-log/get-changes-type-list
  632. page:self.page,
  633. limit: 10
  634. },
  635. method: 'get',
  636. }).then(e => {
  637. //console.log('库存变动类型列表='+JSON.stringify(e))
  638. if(e.data.code == 0){
  639. this.increaseList = e.data.data[0].increase;
  640. this.deductionList = e.data.data[0].deduction;
  641. }
  642. }).catch(e => {
  643. console.log(e);
  644. });
  645. },
  646. switchStatus(row) {
  647. let self = this;
  648. self.listLoading = true;
  649. request({
  650. params: {
  651. r: 'plugin/stock/mall/level/switch-status',
  652. },
  653. method: 'post',
  654. data: {
  655. id: row.id,
  656. }
  657. }).then(e => {
  658. self.listLoading = false;
  659. if (e.data.code === 0) {
  660. self.$message.success(e.data.msg);
  661. } else {
  662. self.$message.error(e.data.msg);
  663. }
  664. self.getList();
  665. }).catch(e => {
  666. console.log(e);
  667. });
  668. },
  669. editClick(id){
  670. if (id){
  671. this.edit.id=id;
  672. this.edit.show=true;
  673. this.edit.title="编辑商品"
  674. }else {
  675. this.edit.show=true;
  676. this.edit.title="添加商品"
  677. }
  678. },
  679. levelDelete(row, index) {
  680. let self = this;
  681. self.$confirm('删除该库存商品, 是否继续?', '提示', {
  682. confirmButtonText: '确定',
  683. cancelButtonText: '取消',
  684. type: 'warning'
  685. }).then(() => {
  686. self.listLoading = true;
  687. request({
  688. params: {
  689. r: 'plugin/stock/mall/goods/delete',
  690. },
  691. method: 'post',
  692. data: {
  693. id: row.id,
  694. }
  695. }).then(e => {
  696. self.listLoading = false;
  697. if (e.data.code === 0) {
  698. self.$message.success(e.data.msg);
  699. self.list.splice(index, 1);
  700. } else {
  701. self.$message.error(e.data.msg);
  702. }
  703. }).catch(e => {
  704. console.log(e);
  705. });
  706. }).catch(() => {
  707. self.$message.info('已取消删除')
  708. });
  709. },
  710. seeDetail(){
  711. this.dialogVisible = true
  712. }
  713. }
  714. });
  715. </script>
  716. <style>
  717. .table-body {
  718. padding: 20px;
  719. background-color: #fff;
  720. }
  721. .input-item {
  722. display: inline-block;
  723. width: 250px;
  724. margin: 0 0 20px;
  725. }
  726. .input-item .el-input__inner {
  727. border-right: 0;
  728. }
  729. .input-item .el-input__inner:hover {
  730. border: 1px solid #dcdfe6;
  731. border-right: 0;
  732. outline: 0;
  733. }
  734. .input-item .el-input__inner:focus {
  735. border: 1px solid #dcdfe6;
  736. border-right: 0;
  737. outline: 0;
  738. }
  739. .input-item .el-input-group__append {
  740. background-color: #fff;
  741. border-left: 0;
  742. width: 10%;
  743. padding: 0;
  744. }
  745. .input-item .el-input-group__append .el-button {
  746. padding: 0;
  747. }
  748. .input-item .el-input-group__append .el-button {
  749. margin: 0;
  750. }
  751. /* .table-body .el-button {
  752. padding: 0 !important;
  753. border: 0;
  754. margin: 0 5px;
  755. } */
  756. .el-table thead{
  757. font-size: 14px;
  758. color: #333;
  759. }
  760. .el-table__footer-wrapper, .el-table__header-wrapper{
  761. border-bottom: 1.4px solid #D6D6D6;
  762. }
  763. .el-date-editor .el-range-separator{/* 设置选择日期框的中间的 ‘至’ 的宽度 */
  764. width: 8%;
  765. }
  766. .title{
  767. font-size: 18px;
  768. font-weight: bold;
  769. display: flex;
  770. align-items: center;
  771. height: 40px;
  772. display: flex;
  773. justify-content: space-between;
  774. }
  775. </style>