refund.php 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450
  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 label="商品类型">
  119. <el-select v-model="search_data.goods_type" clearable placeholder="请选择商品类型">
  120. <el-option v-for="(name, value) in goods_type" :key="value" :label="name" :value="value"></el-option>
  121. </el-select>
  122. </el-form-item>
  123. <el-form-item>
  124. <el-button type="primary" @click="search">搜索</el-button>
  125. <el-button type="danger" @click="clearSearch" v-if="show_clear_search_btn">清除条件</el-button>
  126. </el-form-item>
  127. </el-form>
  128. <!-- 订单表格 start -->
  129. <div class="order-table">
  130. <ul class="tab-title" flex="dir:left cross:center">
  131. <li class="width-50" flex="main:center">
  132. ID
  133. <!-- <el-checkbox v-model="checkAll"></el-checkbox>-->
  134. </li>
  135. <li class="width-400">商品信息</li>
  136. <li class="width-pre10">价格/数量</li>
  137. <li class="width-pre10">售后状态</li>
  138. <li class="width-pre10">商品价格</li>
  139. <li class="width-pre10">售后方式</li>
  140. <li class="width-s">售后原因</li>
  141. <li class="width-s">收货人信息</li>
  142. <li class="">操作</li>
  143. </ul>
  144. <div class="tab-cont" v-for="(item, index) in list" :key="index">
  145. <div class="tab-cont-row" flex="main:justify cross:center">
  146. <div flex="dir:left cross:center">
  147. <div class="width-50" flex="main:center">
  148. <!-- <el-checkbox v-model="checkAll"></el-checkbox>-->
  149. </div>
  150. <div style="padding-right: 20px;">售后编号:{{ item.order_no || '-' }}</div>
  151. <div style="padding-right: 20px;" v-if="item.base_user">用户:({{item.base_user.id}}):{{ item.base_user.nickname || item.base_user.username }}</div>
  152. <div style="padding-right: 20px;">申请时间:{{ item.created_at|dateTimeFormat('Y-m-d H:i:s')}}</div>
  153. <div style="padding-right: 20px;">订单编号:{{ item.order['order_no'] || '-' }}</div>
  154. </div>
  155. </div>
  156. <ul class="tab-cont-info" flex="dir:left cross:center" v-if="true">
  157. <li class="width-50 border-right border-bottom" flex="cross:center">{{ item.id }}</li>
  158. <li class="tab-shop-info width-400 border-bottom" flex="dir:left">
  159. <div style="position: relative;">
  160. <el-image style="width: 50px; height: 50px; border-radius: 5px;" :src="item.orderDetail['pic_url']"></el-image>
  161. </div>
  162. <div class="tab-goods-name">
  163. <com-ellipsis :line="1" :text="item.orderDetail['goods_name'].toString()"></com-ellipsis>
  164. <template v-if="item.orderDetail['attr_list'] && item.orderDetail['attr_list.length'] > 0">
  165. <el-tag style="margin-right: 2px;margin-top: 5px;" v-for="(attrItem, attrIndex) in item.orderDetail['attr_list']" :key="attrIndex" size="small">
  166. {{ attrItem }}
  167. </el-tag>
  168. </template>
  169. <el-tag v-else size="small">
  170. 无规格
  171. </el-tag>
  172. </div>
  173. </li>
  174. <li class="width-pre10 border-bottom">
  175. <div class="cursor" flex="cross:center">
  176. <p style="padding-right: 10px;">
  177. {{getOrderPrice(item.orderDetail)}}
  178. <span v-if="item.orderDetail['adjust_money'] != 0">(调价:¥{{ item.orderDetail['adjust_money'] }})</span>
  179. </p>
  180. </div>
  181. <p>{{ item.orderDetail['num'] }}件</p>
  182. </li>
  183. <li class="width-pre10 border-right border-bottom" flex="cross:center">
  184. <div>
  185. <el-tag size="small" effect="plain" :type="item.refund_status == 1 ? 'success' : 'danger'">{{ refund_status_list[item.refund_status] }}</el-tag>
  186. </div>
  187. </li>
  188. <li class="width-pre10 border-right">
  189. <div>
  190. <p>{{getOrderPrice(item.orderDetail)}}</p>
  191. </div>
  192. </li>
  193. <li class="width-pre10 border-right">
  194. <div>
  195. <p>{{ refund_type_list[item.type] }}</p>
  196. <p v-if="item.type != 3">退款金额:{{getOrderPrice(item.orderDetail)}}</p>
  197. </div>
  198. </li>
  199. <li class="width-s border-right">
  200. <p>{{ item.reason }}</p>
  201. <com-ellipsis :line="1" :text="item.remark.toString()"></com-ellipsis>
  202. </li>
  203. <li class="width-s border-right">
  204. <div v-if="item.order && item.order.province == 0 && item.order.community_addons_data">
  205. <p>{{ item.order.community_addons_data.name | emptyFilled }}</p>
  206. <p>{{ item.order.community_addons_data.contact_name | emptyFilled }}</p>
  207. <p>{{ item.order.community_addons_data.contact_phone | emptyFilled}} </p>
  208. <p style="display: flex;align-items: center;">
  209. <com-ellipsis :line="1" :text="item.order.community_addons_data.address"></com-ellipsis>
  210. </p>
  211. </div>
  212. <div v-else>
  213. <p>{{ item.order.receiver_name | emptyFilled }}</p>
  214. <p>{{ item.order.mobile |emptyFilled}} </p>
  215. <p style="display: flex;align-items: center;">
  216. <com-ellipsis v-if="(item.order.region_name ).trim() != 'null'" :line="1" :text="item.order.region_name + '' + item.order.address"></com-ellipsis>
  217. <span v-else>--</span>
  218. </p>
  219. </div>
  220. </li>
  221. <li>
  222. <el-button size="small" type="text" @click="handle('detail',item)">售后详情</el-button>
  223. </li>
  224. </ul>
  225. </div>
  226. </div>
  227. <div style="text-align: right;margin: 20px 0;">
  228. <el-pagination @current-change="pagination" background layout="prev, pager, next" :page-count="pageCount"></el-pagination>
  229. </div>
  230. <!-- 订单表格 end -->
  231. </el-tab-pane>
  232. </el-tabs>
  233. </div>
  234. </el-card>
  235. </div>
  236. <script>
  237. const app = new Vue({
  238. el: '#app',
  239. data() {
  240. return {
  241. price: 0,
  242. visibles: false,
  243. hidden: false,
  244. current: -1,
  245. detailIndex: -1,
  246. checkAll: false,
  247. checked: false,
  248. select: '',
  249. goods_name: '',
  250. goods_id: '',
  251. tabs: [
  252. {
  253. name: '全部',
  254. value: '999'
  255. },
  256. {
  257. name: '售后申请',
  258. value: '0'
  259. },
  260. {
  261. name: '售后中',
  262. value: '3,4,5'
  263. },
  264. {
  265. name: '售后完成',
  266. value: '1'
  267. }
  268. ],
  269. refund_type_list: {},
  270. refund_status_list: {},
  271. activeName: '999',
  272. list: [],
  273. listLoading: false,
  274. page: 1,
  275. pageCount: 0,
  276. mch_id: 0, // 这个地方不知道要怎么获取
  277. search_data: { // 筛选条件
  278. type: "mobile",
  279. keyword: null,
  280. order_no: null,
  281. goods_type: null,
  282. },
  283. goods_type: <?= $goods_type ?>,
  284. sign:'',
  285. };
  286. },
  287. mounted: function() {
  288. this.getList();
  289. },
  290. created() {
  291. this.sign = getQuery('sign')
  292. },
  293. computed: {
  294. show_clear_search_btn: function() {
  295. return !isEmpty(this.search_data.order_no) || !isEmpty(this.search_data.keyword);
  296. }
  297. },
  298. updated: function() {
  299. // console.log('ssssss')
  300. },
  301. methods: {
  302. handleClick(res) { //标签页切换
  303. if (this.search_data.refund_status == this.activeName) return;
  304. if (this.activeName == '999') {
  305. this.search_data.refund_status = null;
  306. } else {
  307. this.search_data.refund_status = this.activeName;
  308. }
  309. this.getList(this.search_data);
  310. },
  311. search() {
  312. this.getList(this.search_data);
  313. },
  314. clearSearch() {
  315. this.search_data.order_no = null;
  316. this.search_data.type = 'mobile';
  317. this.search_data.keyword = null;
  318. this.getList();
  319. },
  320. handle(type, data = null) {
  321. let id = data ? parseInt(data.id) : '';
  322. switch (type) {
  323. // 订单详情
  324. case 'detail':
  325. let params = {
  326. r: 'store/client/order/refund-detail',
  327. sign:this.sign
  328. };
  329. if (id) params = Object.assign(params, {
  330. id: id
  331. });
  332. navigateTo(params);
  333. break;
  334. // 删除售后
  335. case 'destroy':
  336. param = {
  337. id: data.id,
  338. type
  339. };
  340. this.$confirm('删除该条数据后不可以恢复, 是否继续?', '警告', {
  341. type: 'warning'
  342. }).then(() => {
  343. this.send(param)
  344. }).catch((err) => {})
  345. break;
  346. }
  347. },
  348. send(url, params, callback) {
  349. let self = this;
  350. request({
  351. params: {
  352. r: url,
  353. },
  354. method: 'post',
  355. data: params
  356. }).then(e => {
  357. if (e.data.code == 0) {
  358. self.$message.success(e.data.msg);
  359. self.getList(this.search_data);
  360. } else {
  361. self.$message.error(e.data.msg);
  362. }
  363. if (callback) callback(e.data);
  364. }).catch(e => {
  365. console.log(e);
  366. });
  367. },
  368. pagination(currentPage) {
  369. let self = this;
  370. self.page = currentPage;
  371. self.getList();
  372. },
  373. // 获取商品列表
  374. getList(params = {}) {
  375. let self = this;
  376. let basic_params = {
  377. r: 'store/client/order/refund',
  378. page: self.page,
  379. };
  380. params = Object.assign(basic_params, params);
  381. console.log(params);
  382. if (self.listLoading == false) {
  383. self.listLoading = true;
  384. request({
  385. params: params,
  386. method: 'get',
  387. }).then(e => {
  388. self.listLoading = false;
  389. if (e.data.code == 0) {
  390. self.list = e.data.data.list;
  391. self.refund_type_list = e.data.data.refund_type_list;
  392. self.refund_status_list = e.data.data.refund_status_list;
  393. self.pageCount = e.data.data.page_count;
  394. } else {
  395. self.$message.error(e.data.msg);
  396. }
  397. }).catch(e => {
  398. self.$message.error(e.data.msg);
  399. self.listLoading = false;
  400. });
  401. }
  402. },
  403. getOrderPrice(data){
  404. let text = '';
  405. switch (data.marketing_type) {
  406. case 'ScoreMall' :
  407. text = data.extra_info;
  408. break;
  409. default :
  410. text = '¥'+data.goods_price;
  411. }
  412. return text;
  413. },
  414. }
  415. });
  416. </script>