index.php 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592
  1. <div id="app" v-cloak>
  2. <el-card shadow="never" style="border:0;min-width: 1000px;" body-style="background-color: #f3f3f3;padding: 10px 0 0;">
  3. <div slot="header">
  4. <span>提货管理</span>
  5. </div>
  6. <div class="table-body">
  7. <div>
  8. <el-form :inline="true" :model="search_data" size="small" class="demo-form-inline">
  9. <div class="flex">
  10. <el-form-item label="">
  11. <el-input placeholder="请输入小店ID|昵称" v-model="search_data.store_keyword"
  12. clearable></el-input>
  13. </el-form-item>
  14. <el-form-item label="提货时间">
  15. <el-date-picker v-model="dates" size="small" type="daterange" format="yyyy-MM-dd" value-format="yyyy-MM-dd" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" @change="selectedDates"> </el-date-picker>
  16. </el-form-item>
  17. <el-form-item>
  18. <el-button type="primary" @click="search">搜索</el-button>
  19. <el-button type="danger" @click="clearSearch" v-if="show_clear_search_btn">清除条件</el-button>
  20. </el-form-item>
  21. </div>
  22. </el-form>
  23. </div>
  24. <el-table :data="list" stripe v-loading="listLoading" size="small" style="margin-bottom: 15px; width: 100%">
  25. <el-table-column label="提货时间" width="200" prop="money">
  26. <template slot-scope="scope">
  27. <div v-if="scope.row.created_at>0">{{scope.row.created_at | dateTimeFormat('Y-m-d H:i:s')}}</div>
  28. </template>
  29. </el-table-column>
  30. <el-table-column prop="order_no" label="提货批次" align="center">
  31. <template slot-scope="scope">
  32. <div>{{scope.row.order_no}}</div>
  33. </template>
  34. </el-table-column>
  35. <el-table-column label="收货人信息" width="200" prop="money">
  36. <template slot-scope="scope">
  37. <div>收货人姓名: {{scope.row.user_name}}</div>
  38. <div>手机号: {{scope.row.mobile}}</div>
  39. <div>地址: {{scope.row.address}}</div>
  40. </template>
  41. </el-table-column>
  42. <el-table-column label="配送方式" align="center">
  43. <div>物流配送</div>
  44. </el-table-column>
  45. <el-table-column prop="store_id" label="小店ID" align="center"></el-table-column>
  46. <el-table-column label="小店名称" width="200" prop="store_name">
  47. <template slot-scope="scope">
  48. <div>{{scope.row.store.store_name}}</div>
  49. </template>
  50. </el-table-column>
  51. <el-table-column label="状态" width="200" prop="money">
  52. <template slot-scope="scope">
  53. <div>{{scope.row.order_status_text}}</div>
  54. </template>
  55. </el-table-column>
  56. <el-table-column label="操作" fixed="right" align="center" width="200">
  57. <template slot-scope="scope">
  58. <template>
  59. <el-button v-if="scope.row.order_status==0" type="text" size="small" @click="audit(scope.row)">审核</el-button>
  60. <el-button v-if="scope.row.order_status==1" type="text" size="small" @click="send(scope.row)">确认发货</el-button>
  61. <el-button v-if="scope.row.order_status==2" type="text" size="small" @click="send(scope.row)">继续发货</el-button>
  62. <el-button v-if="scope.row.order_status>=1" type="text" size="small" @click="express
  63. (scope.row)">发货详情</el-button>
  64. <el-button v-if="scope.row.order_status>=1" type="text" size="small" @click="showGoods(scope.row)">查看商品</el-button>
  65. </template>
  66. </template>
  67. </el-table-column>
  68. </el-table>
  69. <div style="text-align: right;margin: 20px 0;">
  70. <el-pagination @current-change="pagination" background layout="prev, pager, next" :page-count="pageCount"></el-pagination>
  71. </div>
  72. </div>
  73. <el-dialog title="是否允许提货" :visible.sync="dialogVisible" width="500px">
  74. <el-form :inline="true" :model="auditForm" size="small" class="demo-form-inline">
  75. <!--提货的商品-->
  76. <div>
  77. <el-table :data="detail.goods" stripe size="small" style="margin-bottom: 15px; width: 100%">
  78. <el-table-column label="商品图片" width="100">
  79. <template slot-scope="scope">
  80. <div v-if="scope.row.cover_pic">
  81. <img :src="scope.row.cover_pic" style="width: 50px;heightheight: 50px;">
  82. </div>
  83. </template>
  84. </el-table-column>
  85. <el-table-column label="商品名称" width="200">
  86. <template slot-scope="scope">
  87. <div>{{scope.row.goods_name}}{{scope.row.goods_attr_name}}</div>
  88. </template>
  89. </el-table-column>
  90. <el-table-column label="提货数量">
  91. <template slot-scope="scope">
  92. <div>{{scope.row.num}}件</div>
  93. </template>
  94. </el-table-column>
  95. </el-table>
  96. </div>
  97. <div style="margin-top: 20px">
  98. <el-input v-if="auditForm.status==0" placeholder="请输入备注" v-model="auditForm.remark" type="textarea"
  99. clearable></el-input>
  100. </div>
  101. <div style="margin-top: 20px;text-align: center">
  102. <el-radio-group v-model="auditForm.status">
  103. <el-radio label="1">允许提货</el-radio>
  104. <el-radio label="0">拒绝提货</el-radio>
  105. </el-radio-group>
  106. </div>
  107. <div style="margin-top: 20px;text-align: center">
  108. <el-button size="mini" type="primary" :loading="btnLoading" @click="handle('audit',auditForm)">提交</el-button>
  109. <el-button size="mini" @click="dialogVisible=false">取消</el-button>
  110. </div>
  111. </el-form>
  112. </el-dialog>
  113. <el-dialog title="确认发货" :visible.sync="dialogSendVisible" width="1200px">
  114. <el-form :inline="true" :model="sendForm" size="small" class="demo-form-inline">
  115. <el-form-item label="发货单号">
  116. <el-input size="small" v-model="sendForm.express_no" placeholder="请输入发货单号"></el-input>
  117. </el-form-item>
  118. <el-form-item label="物流公司">
  119. <el-input size="small" v-model="sendForm.express_company" placeholder="请输入物流公司"></el-input>
  120. </el-form-item>
  121. <el-table :data="sendForm.goods" stripe size="small" style="margin-bottom: 15px; width: 100%">
  122. <el-table-column label="商品图片" width="100">
  123. <template slot-scope="scope">
  124. <div v-if="scope.row.cover_pic">
  125. <img :src="scope.row.cover_pic" style="width: 50px;heightheight: 50px;">
  126. </div>
  127. </template>
  128. </el-table-column>
  129. <el-table-column label="商品名称" width="200">
  130. <template slot-scope="scope">
  131. <div>{{scope.row.goods_name}}{{scope.row.goods_attr_name}}</div>
  132. </template>
  133. </el-table-column>
  134. <el-table-column label="提货数量">
  135. <template slot-scope="scope">
  136. <div>{{scope.row.leave_num}}件</div>
  137. </template>
  138. </el-table-column>
  139. <el-table-column label="生产日期">
  140. <template slot-scope="scope">
  141. <el-date-picker size="small" style="width: 150px" v-model="scope.row.create_date"
  142. size="small"
  143. format="yyyy-MM-dd"
  144. value-format="yyyy-MM-dd"> </el-date-picker>
  145. </template>
  146. </el-table-column>
  147. <el-table-column label="保质期">
  148. <template slot-scope="scope">
  149. <el-input style="width: 100px" size="small" v-model="scope.row.save_day"
  150. type="number">
  151. </el-input>
  152. 天
  153. </template>
  154. </el-table-column>
  155. <el-table-column label="过期时间" >
  156. <template slot-scope="scope">
  157. <div v-if="scope.row.create_date && scope.row.save_day">
  158. <!-- 显示计算结果并同时更新数据模型 -->
  159. {{ updateAndShowExpireDate(scope.row, scope.$index) }}
  160. </div>
  161. <div v-else>
  162. {{ scope.row.expire_date }}
  163. </div>
  164. </template>
  165. </el-table-column>
  166. <el-table-column label="发货数量">
  167. <template slot-scope="scope">
  168. <el-input style="width: 100px" size="small" v-model="scope.row.send_num" placeholder="发货数量" :min="1"
  169. :max="scope.row.leave_num" type="number" clearable></el-input>
  170. </template>
  171. </el-table-column>
  172. </el-table>
  173. <div style="margin-top: 20px;text-align: center">
  174. <el-button size="mini" type="primary" :loading="btnLoading" @click="handle('send',sendForm)">提交</el-button>
  175. <el-button size="mini" @click="dialogSendVisible=false">取消</el-button>
  176. </div>
  177. </el-form>
  178. </el-dialog>
  179. <el-dialog title="发货详情" :visible.sync="dialogExpressVisible" width="1200px">
  180. <div v-for="(item,index) in express_list">
  181. <div style="margin-left: 10px"><span style="margin-right: 50px">物流单号:{{item
  182. .express_no}}</span><span>物流公司:{{item
  183. .express_company}}</span></div>
  184. <el-table :data="item.goods" stripe size="small" style="margin-bottom: 15px; width: 100%">
  185. <el-table-column label="商品图片" width="100">
  186. <template slot-scope="scope">
  187. <div v-if="scope.row.cover_pic">
  188. <img :src="scope.row.cover_pic" style="width: 50px;heightheight: 50px;">
  189. </div>
  190. </template>
  191. </el-table-column>
  192. <el-table-column label="商品名称" width="200">
  193. <template slot-scope="scope">
  194. <div>{{scope.row.goods_name}}{{scope.row.goods_attr_name}}</div>
  195. </template>
  196. </el-table-column>
  197. <el-table-column label="提货数量">
  198. <template slot-scope="scope">
  199. <div>{{scope.row.buy_num}}件</div>
  200. </template>
  201. </el-table-column>
  202. <el-table-column label="生产日期">
  203. <template slot-scope="scope">
  204. <div>{{scope.row.create_date | dateTimeFormat("Y-m-d")}}</div>
  205. </template>
  206. </el-table-column>
  207. <el-table-column label="保质期">
  208. <template slot-scope="scope">
  209. <div>{{scope.row.save_day}}天</div>
  210. </template>
  211. </el-table-column>
  212. <el-table-column label="过期时间" >
  213. <template slot-scope="scope">
  214. <div>{{scope.row.expire_date | dateTimeFormat("Y-m-d")}}</div>
  215. </template>
  216. </el-table-column>
  217. <el-table-column label="发货数量">
  218. <template slot-scope="scope">
  219. <div>{{scope.row.num}}</div>
  220. </template>
  221. </el-table-column>
  222. </el-table>
  223. </div>
  224. <div style="margin-top: 20px;text-align: center">
  225. <el-button size="mini" @click="dialogExpressVisible=false">取消</el-button>
  226. </div>
  227. </el-dialog>
  228. <el-dialog title="查看商品" :visible.sync="dialogGoodsVisible" width="1200px">
  229. <el-table :data="detail.goods" stripe size="small" style="margin-bottom: 15px; width: 100%">
  230. <el-table-column label="商品图片" width="100">
  231. <template slot-scope="scope">
  232. <div v-if="scope.row.cover_pic">
  233. <img :src="scope.row.cover_pic" style="width: 50px;heightheight: 50px;">
  234. </div>
  235. </template>
  236. </el-table-column>
  237. <el-table-column label="商品名称" width="200">
  238. <template slot-scope="scope">
  239. <div>{{scope.row.goods_name}}{{scope.row.goods_attr_name}}</div>
  240. </template>
  241. </el-table-column>
  242. <el-table-column label="提货数量">
  243. <template slot-scope="scope">
  244. <div>{{scope.row.num}}件</div>
  245. </template>
  246. </el-table-column>
  247. <el-table-column label="剩余待发数量">
  248. <template slot-scope="scope">
  249. <div>{{scope.row.leave_num}}</div>
  250. </template>
  251. </el-table-column>
  252. </el-table>
  253. <div style="margin-top: 20px;text-align: center">
  254. <el-button size="mini" @click="dialogGoodsVisible=false">取消</el-button>
  255. </div>
  256. </el-dialog>
  257. </el-card>
  258. </div>
  259. <script>
  260. const app = new Vue({
  261. el: '#app',
  262. data() {
  263. return {
  264. search_data: {
  265. store_keyword:'',
  266. start_time:'',
  267. end_time:''
  268. },
  269. btnLoading:false,
  270. list: [],
  271. dates: null,
  272. page: 1,
  273. pageCount: 0,
  274. listLoading: false,
  275. auditForm:{
  276. id:'',
  277. remark:'',
  278. status:'1',
  279. },
  280. sendForm:{
  281. id:'',
  282. express_company:'',
  283. express_no:'',
  284. goods:[]
  285. },
  286. detail:[],
  287. dialogVisible:false,
  288. dialogSendVisible:false,
  289. dialogExpressVisible:false,
  290. dialogGoodsVisible:false,
  291. express_list:[],
  292. };
  293. },
  294. mounted: function() {
  295. this.getList();
  296. },
  297. computed: {
  298. show_clear_search_btn: function() {
  299. return !isEmpty(this.search_data.store_keyword) || !isEmpty(this.search_data.start_time) || !isEmpty(this.search_data
  300. .end_time);
  301. }
  302. },
  303. methods: {
  304. // 添加更新并显示过期日期的方法
  305. updateAndShowExpireDate(row, index) {
  306. const expireDate = this.getComputedExpireDate(row.create_date, row.save_day);
  307. // 更新数据模型
  308. this.$set(this.sendForm.goods[index], 'expire_date', expireDate);
  309. // 返回显示值
  310. return expireDate;
  311. },
  312. // 计算过期日期显示值
  313. getComputedExpireDate(createDate, saveDay) {
  314. if (!createDate || !saveDay) return '';
  315. try {
  316. let date = new Date(createDate);
  317. date.setDate(date.getDate() + parseInt(saveDay));
  318. return date.toISOString().split('T')[0];
  319. } catch (e) {
  320. return '';
  321. }
  322. },
  323. // 选中时间
  324. selectedDates(e) {
  325. if (e) {
  326. this.search_data.start_time = e[0];
  327. this.search_data.end_time = e[1];
  328. } else {
  329. this.search_data.start_time = '';
  330. this.search_data.end_time = '';
  331. this.dates = null;
  332. }
  333. },
  334. pagination(currentPage) {
  335. let self = this;
  336. self.page = currentPage;
  337. self.getList();
  338. },
  339. getDetail(id,type)
  340. {
  341. let self = this;
  342. request({
  343. params: {
  344. r: 'happiness/store-voucher-order/detail',
  345. id: id,
  346. },
  347. method: 'get',
  348. }).then(e => {
  349. if(e.data.code === 0)
  350. {
  351. self.detail=e.data.data;
  352. if(type=='send')
  353. {
  354. self.sendForm.goods=[]
  355. for(let i in e.data.data.goods)
  356. {
  357. if(e.data.data.goods[i].leave_num>0)
  358. {
  359. self.sendForm.goods.push({
  360. goods_id:e.data.data.goods[i].goods_id,
  361. goods_name:e.data.data.goods[i].goods_name,
  362. goods_attr_name:e.data.data.goods[i].goods_attr_name,
  363. leave_num:e.data.data.goods[i].leave_num,
  364. attr_id:e.data.data.goods[i].attr_id,
  365. send_num:0,
  366. create_date:'',
  367. expire_date:'',
  368. save_day:'',
  369. id:e.data.data.goods[i].id,
  370. cover_pic:e.data.data.goods[i].cover_pic,
  371. })
  372. }
  373. }
  374. }
  375. if(type=='audit')
  376. {
  377. self.auditForm.goods=e.data.data.goods;
  378. }
  379. }
  380. else
  381. {
  382. self.$message.error(e.data.msg);
  383. }
  384. }).catch(e => {
  385. });
  386. },
  387. express(row)
  388. {
  389. this.dialogExpressVisible=true;
  390. let self = this;
  391. let basic_params = {
  392. r: 'happiness/store-voucher-order/express',
  393. id:row.id
  394. };
  395. request({
  396. params: basic_params,
  397. method: 'get',
  398. }).then(e => {
  399. self.listLoading = false;
  400. if (e.data.code === 0) {
  401. self.express_list = e.data.data;
  402. } else {
  403. self.$message.error(e.data.msg);
  404. }
  405. }).catch(e => {
  406. });
  407. },
  408. audit(row)
  409. {
  410. this.auditForm.id=row.id;
  411. this.getDetail(row.id,'audit');
  412. this.dialogVisible=true;
  413. },
  414. send(row)
  415. {
  416. this.sendForm.id=row.id;
  417. this.getDetail(row.id,'send');
  418. this.dialogSendVisible=true;
  419. },
  420. showGoods(row)
  421. {
  422. this.sendForm.id=row.id;
  423. this.getDetail(row.id,'goods');
  424. this.dialogGoodsVisible=true;
  425. },
  426. getList(id) {
  427. let self = this;
  428. let basic_params = {
  429. r: 'happiness/store-voucher-order/index',
  430. page: self.page,
  431. };
  432. params = Object.assign(basic_params, this.search_data);
  433. if (self.listLoading === false) {
  434. self.listLoading = true;
  435. request({
  436. params: params,
  437. method: 'get',
  438. }).then(e => {
  439. self.listLoading = false;
  440. if (e.data.code === 0) {
  441. self.list = e.data.data.list;
  442. self.pageCount = e.data.data.page_count;
  443. } else {
  444. self.$message.error(e.data.msg);
  445. }
  446. }).catch(e => {
  447. });
  448. }
  449. },
  450. search() {
  451. this.page = 1;
  452. this.getList();
  453. },
  454. clearSearch() {
  455. this.search_data.store_keyword = null;
  456. this.search_data.start_time = null;
  457. this.search_data.end_time = null;
  458. this.dates = null;
  459. this.getList();
  460. },
  461. handle(type, data = null) {
  462. let id = data ? parseInt(data.id) : '';
  463. let user_id = data ? parseInt(data.user_id) : '';
  464. switch (type) {
  465. case 'audit':
  466. //确认提示
  467. this.btnLoading=true;
  468. this.$request({
  469. params: {
  470. r: 'happiness/store-voucher-order/switch-status'
  471. },
  472. data:this.auditForm,
  473. method: 'post',
  474. }).then(e => {
  475. if (e.data.code === 0) {
  476. if(this.auditForm.status==1)
  477. {
  478. this.$message.success('审核通过');
  479. }
  480. else
  481. {
  482. this.$message.success('已拒绝');
  483. }
  484. this.getList();
  485. this.btnLoading=false;
  486. this.dialogVisible=false;
  487. } else {
  488. this.$message.error(e.data.msg);
  489. this.btnLoading=false;
  490. }
  491. }).catch(e => {
  492. });
  493. break;
  494. case 'send':
  495. //确认提示
  496. this.btnLoading=true;
  497. this.$request({
  498. params: {
  499. r: 'happiness/store-voucher-order/send'
  500. },
  501. data:this.sendForm,
  502. method: 'post',
  503. }).then(e => {
  504. if (e.data.code === 0) {
  505. this.$message.success('发货成功');
  506. this.getList();
  507. this.btnLoading=false;
  508. this.dialogSendVisible=false;
  509. } else {
  510. this.$message.error(e.data.msg);
  511. this.btnLoading=false;
  512. }
  513. }).catch(e => {
  514. });
  515. break;
  516. }
  517. },
  518. }
  519. })
  520. </script>
  521. <style>
  522. .flex {
  523. display: flex;
  524. align-items: center;
  525. }
  526. .stat_details{
  527. padding: 0 0 20px;
  528. display: flex;
  529. }
  530. .stat_details .order_module{
  531. flex: 1;
  532. background: #F2F2F2;
  533. margin: 0 5px;
  534. padding: 20px 25px;
  535. }
  536. .order_module{
  537. display: flex;
  538. flex-direction: column;
  539. }
  540. .order_module:last-child{
  541. margin-right: 0;
  542. }
  543. .order_module:first-child{
  544. margin-left: 0;
  545. }
  546. .price{
  547. font-size: 14px;
  548. flex: 1;
  549. word-break: break-all;
  550. }
  551. .oirder_modul_title{
  552. font-size: 12px;
  553. margin-bottom: 10px;
  554. display: flex;
  555. align-items: center;
  556. }
  557. ..el-input__inner{
  558. border-right: 1px solid #EBEEF5;
  559. }
  560. .oirder_modul_title .text{
  561. margin-right: 10px;
  562. }
  563. .stat_icon{
  564. font-size: 19px;
  565. color: #BFBFBF;
  566. }
  567. </style>