refund.php 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418
  1. <?php
  2. use common\helpers\ComponentHelper;
  3. ?>
  4. <style>
  5. .demo-form-inline .el-select .el-input {
  6. width: 100px;
  7. }
  8. /* 订单表格 start */
  9. .width-pre10 {
  10. width: 10%;
  11. }
  12. .width-50 {
  13. width: 80px;
  14. }
  15. .width-400 {
  16. width: 350px;
  17. }
  18. .order-table {
  19. overflow-x: scroll;
  20. }
  21. .tab-title,
  22. .tab-cont {
  23. width: 100%;
  24. min-width: 1290px;
  25. font-size: 13px;
  26. }
  27. .tab-title {
  28. padding: 20px 0;
  29. }
  30. .tab-title>li {
  31. padding: 0 10px;
  32. }
  33. .tab-cont {
  34. border: 1px solid #F2F2F2;
  35. margin-bottom: 20px;
  36. }
  37. .tab-cont-row {
  38. padding: 10px 0;
  39. background-color: #F7F7F7;
  40. }
  41. .tab-cont-info {
  42. height: 100px;
  43. }
  44. .tab-cont-info>li {
  45. /* display: flex;
  46. flex-direction: column;
  47. justify-content: center; */
  48. height: 100%;
  49. padding: 16px 10px;
  50. }
  51. .tab-btns {
  52. width: 320px;
  53. margin-right: 20px;
  54. }
  55. .tab-goods-name {
  56. margin: 0 10px;
  57. }
  58. .border-right {
  59. border-right: 1px solid #f2f2f2;
  60. }
  61. .border-bottom {
  62. border-bottom: 1px solid #f2f2f2;
  63. }
  64. .no-border-bottom {
  65. border-bottom: none !important;
  66. }
  67. .cursor {
  68. cursor: pointer;
  69. }
  70. .edit-icon {
  71. color: #03c5ff;
  72. cursor: pointer;
  73. }
  74. .popover-btn {
  75. font-size: 12px;
  76. padding: 0 10px;
  77. border-right: 1px solid var(--primary, #03c5ff);
  78. cursor: pointer;
  79. display: inline-block;
  80. line-height: 1;
  81. color: #03c5ff;
  82. }
  83. .popover-btn:last-child {
  84. border-right: none;
  85. }
  86. .width-s {
  87. width: 250px;
  88. }
  89. .el-button--text {
  90. padding: 0 !important;
  91. }
  92. /* 订单表格 end */
  93. </style>
  94. <div id="app" v-cloak>
  95. <el-card shadow="never" body-style="background-color: #f3f3f3;padding: 10px 0 0;">
  96. <div slot="header">
  97. <span>订单列表</span>
  98. <div style="float: right; margin: -5px 0">
  99. <!-- <el-button type="primary" size="small" @click="handle('edit')">添加商品</el-button>
  100. <el-button type="primary" size="small">商品导出</el-button> -->
  101. </div>
  102. </div>
  103. <div class="table-body">
  104. <el-tabs v-model="activeName" @tab-click="handleClick">
  105. <el-tab-pane v-for="item in tabs" :key="item.value" :label="item.name" :name="item.value">
  106. <el-form :inline="true" :model="search_data" size="small" class="demo-form-inline">
  107. <el-form-item label="订单号">
  108. <el-input placeholder="请输入订单号" v-model="search_data.order_no"></el-input>
  109. </el-form-item>
  110. <el-form-item label="">
  111. <el-input placeholder="请输入内容" v-model="search_data.keyword" class="input-with-select">
  112. <el-select v-model="search_data.type" slot="prepend" placeholder="请选择">
  113. <el-option label="用户电话" value="mobile"></el-option>
  114. <el-option label="商品名称" value="goods_name"></el-option>
  115. </el-select>
  116. </el-input>
  117. </el-form-item>
  118. <el-form-item>
  119. <el-button type="primary" @click="search">搜索</el-button>
  120. <el-button type="danger" @click="clearSearch" v-if="show_clear_search_btn">清除条件</el-button>
  121. </el-form-item>
  122. </el-form>
  123. <!-- 订单表格 start -->
  124. <div class="order-table">
  125. <ul class="tab-title" flex="dir:left cross:center">
  126. <li class="width-50" flex="main:center">
  127. ID
  128. <!-- <el-checkbox v-model="checkAll"></el-checkbox>-->
  129. </li>
  130. <li class="width-400">商品信息</li>
  131. <li class="width-pre10">价格/数量</li>
  132. <li class="width-pre10">售后状态</li>
  133. <li class="width-pre10">商品价格</li>
  134. <li class="width-pre10">售后方式</li>
  135. <li class="width-s">售后原因</li>
  136. <li class="">操作</li>
  137. </ul>
  138. <div class="tab-cont" v-for="(item, index) in list" :key="index">
  139. <div class="tab-cont-row" flex="main:justify cross:center">
  140. <div flex="dir:left cross:center">
  141. <div class="width-50" flex="main:center">
  142. <!-- <el-checkbox v-model="checkAll"></el-checkbox>-->
  143. </div>
  144. <div style="padding-right: 20px;">售后编号:{{ item.order_no || '-' }}</div>
  145. <div style="padding-right: 20px;">用户:{{ item.base_user.nickname || '-' }}</div>
  146. <div style="padding-right: 20px;">申请时间:{{ item.created_at|dateTimeFormat('Y-m-d H:i:s')}}</div>
  147. <div style="padding-right: 20px;">订单编号:{{ item.order['order_no'] || '-' }}</div>
  148. </div>
  149. </div>
  150. <ul class="tab-cont-info" flex="dir:left cross:center" v-if="true">
  151. <li class="width-50 border-right border-bottom" flex="cross:center">{{ item.id }}</li>
  152. <li class="tab-shop-info width-400 border-bottom" flex="dir:left">
  153. <div style="position: relative;">
  154. <el-image style="width: 50px; height: 50px; border-radius: 5px;" :src="item.orderDetail['pic_url']"></el-image>
  155. </div>
  156. <div class="tab-goods-name">
  157. <com-ellipsis :line="1" :text="item.orderDetail['goods_name'].toString()"></com-ellipsis>
  158. <template v-if="item.orderDetail['attr_list'] && item.orderDetail['attr_list.length'] > 0">
  159. <el-tag style="margin-right: 2px;margin-top: 5px;" v-for="(attrItem, attrIndex) in item.orderDetail['attr_list']" :key="attrIndex" size="small">
  160. {{ attrItem }}
  161. </el-tag>
  162. </template>
  163. <el-tag v-else size="small">
  164. 无规格
  165. </el-tag>
  166. </div>
  167. </li>
  168. <li class="width-pre10 border-bottom">
  169. <div class="cursor" flex="cross:center">
  170. <p style="padding-right: 10px;">
  171. {{getOrderPrice(item.orderDetail)}}
  172. <span v-if="item.orderDetail['adjust_money'] != 0">(调价:¥{{ item.orderDetail['adjust_money'] }})</span>
  173. </p>
  174. </div>
  175. <p>{{ item.orderDetail['num'] }}件</p>
  176. </li>
  177. <li class="width-pre10 border-right border-bottom" flex="cross:center">
  178. <div>
  179. <el-tag size="small" effect="plain" :type="item.refund_status == 1 ? 'success' : 'danger'">{{ refund_status_list[item.refund_status] }}</el-tag>
  180. </div>
  181. </li>
  182. <li class="width-pre10 border-right">
  183. <div>
  184. <p>{{getOrderPrice(item.orderDetail)}}</p>
  185. </div>
  186. </li>
  187. <li class="width-pre10 border-right">
  188. <div>
  189. <p>{{ refund_type_list[item.type] }}</p>
  190. <p v-if="item.type != 3">退款金额:{{getOrderPrice(item.orderDetail)}}</p>
  191. </div>
  192. </li>
  193. <li class="width-s border-right">
  194. <p>{{ item.reason }}</p>
  195. <com-ellipsis :line="1" :text="item.remark.toString()"></com-ellipsis>
  196. </li>
  197. <li>
  198. <el-button size="small" type="text" @click="handle('detail',item)">售后详情</el-button>
  199. </li>
  200. </ul>
  201. </div>
  202. </div>
  203. <div style="text-align: right;margin: 20px 0;">
  204. <el-pagination @current-change="pagination" background layout="prev, pager, next" :page-count="pageCount"></el-pagination>
  205. </div>
  206. <!-- 订单表格 end -->
  207. </el-tab-pane>
  208. </el-tabs>
  209. </div>
  210. </el-card>
  211. </div>
  212. <script>
  213. const app = new Vue({
  214. el: '#app',
  215. data() {
  216. return {
  217. price: 0,
  218. visibles: false,
  219. hidden: false,
  220. current: -1,
  221. detailIndex: -1,
  222. checkAll: false,
  223. checked: false,
  224. select: '',
  225. goods_name: '',
  226. goods_id: '',
  227. tabs: [
  228. {
  229. name: '全部',
  230. value: '999'
  231. },
  232. {
  233. name: '售后申请',
  234. value: '0'
  235. },
  236. {
  237. name: '售后中',
  238. value: '3,4,5'
  239. },
  240. {
  241. name: '售后完成',
  242. value: '1'
  243. }
  244. ],
  245. refund_type_list: {},
  246. refund_status_list: {},
  247. activeName: '999',
  248. list: [],
  249. listLoading: false,
  250. page: 1,
  251. pageCount: 0,
  252. mch_id: 0, // 这个地方不知道要怎么获取
  253. search_data: { // 筛选条件
  254. type: null,
  255. keyword: null,
  256. order_no: null,
  257. },
  258. };
  259. },
  260. mounted: function() {
  261. this.getList();
  262. },
  263. computed: {
  264. show_clear_search_btn: function() {
  265. return !isEmpty(this.search_data.order_no) || !isEmpty(this.search_data.keyword);
  266. }
  267. },
  268. updated: function() {
  269. // console.log('ssssss')
  270. },
  271. methods: {
  272. handleClick(res) { //标签页切换
  273. if (this.search_data.refund_status == this.activeName) return;
  274. if (this.activeName == '999') {
  275. this.search_data.refund_status = null;
  276. } else {
  277. this.search_data.refund_status = this.activeName;
  278. }
  279. this.getList(this.search_data);
  280. },
  281. search() {
  282. this.getList(this.search_data);
  283. },
  284. clearSearch() {
  285. this.search_data.order_no = null;
  286. this.search_data.type = null;
  287. this.search_data.keyword = null;
  288. this.getList();
  289. },
  290. handle(type, data = null) {
  291. let id = data ? parseInt(data.id) : '';
  292. switch (type) {
  293. // 订单详情
  294. case 'detail':
  295. let params = {
  296. r: 'mall/order/refund-detail'
  297. };
  298. if (id) params = Object.assign(params, {
  299. id: id
  300. });
  301. navigateTo(params);
  302. break;
  303. // 删除售后
  304. case 'destroy':
  305. param = {
  306. id: data.id,
  307. type
  308. };
  309. this.$confirm('删除该条数据后不可以恢复, 是否继续?', '警告', {
  310. type: 'warning'
  311. }).then(() => {
  312. this.send(param)
  313. }).catch((err) => {})
  314. break;
  315. }
  316. },
  317. send(url, params, callback) {
  318. let self = this;
  319. request({
  320. params: {
  321. r: url,
  322. },
  323. method: 'post',
  324. data: params
  325. }).then(e => {
  326. if (e.data.code == 0) {
  327. self.$message.success(e.data.msg);
  328. self.getList(this.search_data);
  329. } else {
  330. self.$message.error(e.data.msg);
  331. }
  332. if (callback) callback(e.data);
  333. }).catch(e => {
  334. console.log(e);
  335. });
  336. },
  337. pagination(currentPage) {
  338. let self = this;
  339. self.page = currentPage;
  340. self.getList();
  341. },
  342. // 获取商品列表
  343. getList(params = {}) {
  344. let self = this;
  345. let basic_params = {
  346. r: 'mall/order/refund',
  347. page: self.page,
  348. };
  349. params = Object.assign(basic_params, params);
  350. console.log(params);
  351. if (self.listLoading == false) {
  352. self.listLoading = true;
  353. request({
  354. params: params,
  355. method: 'get',
  356. }).then(e => {
  357. self.listLoading = false;
  358. if (e.data.code == 0) {
  359. self.list = e.data.data.list;
  360. self.refund_type_list = e.data.data.refund_type_list;
  361. self.refund_status_list = e.data.data.refund_status_list;
  362. self.pageCount = e.data.data.page_count;
  363. } else {
  364. self.$message.error(e.data.msg);
  365. }
  366. }).catch(e => {
  367. self.$message.error(e.data.msg);
  368. self.listLoading = false;
  369. });
  370. }
  371. },
  372. getOrderPrice(data){
  373. let text = '';
  374. switch (data.marketing_type) {
  375. case 'ScoreMall' :
  376. text = data.extra_info;
  377. break;
  378. default :
  379. text = '¥'+data.goods_price;
  380. }
  381. return text;
  382. },
  383. }
  384. });
  385. </script>