order-message.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460
  1. <template>
  2. <app-layout>
  3. <app-tab-nav :tabList="tabList" padding="0" :activeItem="activeTab" @click="tabStatus" theme="blue"></app-tab-nav>
  4. <view class="order main-center cross-center">
  5. <view @click="choose" class="main-center cross-center">
  6. <view>{{active.name}}</view>
  7. <image class="more" src="../image/open.png"></image>
  8. </view>
  9. </view>
  10. <view class="order-placeholder"></view>
  11. <view @click="toOrder(item.order_no)" v-for="item in list" :key="item.id">
  12. <view class="msg-item">
  13. <view class="msg-title" v-if="activeTab==8"><text class="plugin-name">{{item.plugin_name}}</text>有新订单啦</view>
  14. <view class="msg-title" v-if="activeTab==4">退款申请</view>
  15. <view class="msg-title cross-center" v-if="activeTab==1 && item.type == 2">
  16. <text class='replace'></text>换货申请</view>
  17. <view class="msg-title cross-center" v-if="activeTab==1 && item.type == 1">
  18. <text class='return'></text>退货退款申请</view>
  19. <view class="msg-time">{{item.created_at}}</view>
  20. <view class="goods-info">
  21. <image class="goods-img" :src='activeTab == 1? item.detail.goods_info.goods_attr.cover_pic: item.detail[0].goods.goodsWarehouse.cover_pic'></image>
  22. <view class="goods-name t-omit-two">
  23. <text>{{activeTab == 1? item.detail.goods_info.goods_attr.name : item.detail[0].goods.goodsWarehouse.name}}</text>
  24. <text v-if="item.detail.length > 1 && activeTab != 1">等{{item.detail.length}}件商品</text>
  25. </view>
  26. <view class="goods-user">来自用户{{item.nickname}}</view>
  27. </view>
  28. </view>
  29. </view>
  30. <view class='no-tip' v-if="list.length === 0 && !loading">
  31. <image :src='adminImg.no_message'></image>
  32. <view>没有任何消息哦~</view>
  33. </view>
  34. <!-- 选择列表 -->
  35. <view class="dialog" v-if="dialog">
  36. <view class="picker-list">
  37. <view class="main-between picker-header">
  38. <view @click="toggle(false,2)">取消</view>
  39. <view @click="toggle(false,1)">确定</view>
  40. </view>
  41. <picker-view indicator-style="height: 36px;" :value="[index]" @change="bindChange">
  42. <picker-view-column>
  43. <view
  44. v-for="(item,idx) in choose_list" :key="item.name"
  45. :class="[`picker-view`,{
  46. 'sure-color': newIndex === idx,
  47. 'cardinal-color': newIndex === idx + 1 || newIndex === idx - 1,
  48. 'even-color': newIndex === idx + 2 || newIndex === idx - 2,
  49. }]"
  50. >{{item.name}}
  51. </view>
  52. </picker-view-column>
  53. </picker-view>
  54. </view>
  55. </view>
  56. </app-layout>
  57. </template>
  58. <script>
  59. import appTabNav from "../../../components/basic-component/app-tab-nav/app-tab-nav.vue";
  60. import { mapState } from "vuex";
  61. export default {
  62. data() {
  63. return {
  64. tabList: [
  65. {id:8, name: '下单提醒'},
  66. {id:4, name: '退款提醒'},
  67. {id:1, name: '售后提醒'}
  68. ],
  69. more_list: false,
  70. dialog: false,
  71. activeTab: 8,
  72. index: 0,
  73. choose_list: [],
  74. list: [],
  75. newIndex: 0,
  76. page: 1,
  77. loading: false,
  78. today: '',
  79. yesterday: '',
  80. active: {
  81. sign: 'all',
  82. name: '全部',
  83. },
  84. num: {}
  85. }
  86. },
  87. components: {
  88. "app-tab-nav": appTabNav,
  89. },
  90. computed: {
  91. ...mapState({
  92. userInfo: state => state.user.info,
  93. adminImg: state => state.mallConfig.__wxapp_img.app_admin,
  94. })
  95. },
  96. methods: {
  97. choose() {
  98. this.dialog = true;
  99. },
  100. toggle(boolean,type) {
  101. this.dialog = boolean;
  102. if(type == 1) {
  103. uni.showLoading({
  104. title: '加载中...'
  105. });
  106. this.index = this.newIndex;
  107. this.active = this.choose_list[this.index];
  108. this.list = [];
  109. this.page = 1;
  110. if (this.activeTab == 1) {
  111. this.getPut();
  112. } else {
  113. this.getList();
  114. }
  115. }else {
  116. this.newIndex = this.index;
  117. }
  118. },
  119. bindChange(e) {
  120. this.newIndex = e.detail.value[0];
  121. },
  122. toOrder(id) {
  123. uni.navigateTo({
  124. url: '/pages/app_admin/order/order?no='+id+'&msg=1'
  125. });
  126. },
  127. tabStatus(e) {
  128. this.list = [];
  129. this.page = 1;
  130. this.activeTab = e.currentTarget.dataset.id;
  131. uni.showLoading({
  132. title: '加载中...'
  133. });
  134. if (this.activeTab == 1) {
  135. this.getPut();
  136. } else {
  137. this.getList();
  138. }
  139. },
  140. getPut() {
  141. let that = this;
  142. if(that.loading) {
  143. return false
  144. }
  145. that.loading = true;
  146. that.$request({
  147. url: that.$api.app_admin.refund,
  148. data: {
  149. status: 0,
  150. sign: that.active.sign,
  151. page: that.page
  152. }
  153. }).then(response=>{
  154. that.loading = false;
  155. uni.hideLoading();
  156. if(response.code == 0) {
  157. response.data.list.forEach(function(row,index){
  158. if (row.created_at.substring(0,10) == that.today) {
  159. row.created_at = row.created_at.substring(11)
  160. } else if (row.created_at.substring(0, 10) == that.yesterday) {
  161. row.created_at = '昨天'
  162. }else {
  163. row.created_at = row.created_at.substring(0, 10)
  164. }
  165. })
  166. that.list = that.list.concat(response.data.list);
  167. that.page++;
  168. that.more_list = false;
  169. if (response.data.list.length == response.data.pagination.pageSize) {
  170. that.more_list = true;
  171. }
  172. }else {
  173. uni.showToast({
  174. title: response.msg,
  175. icon: 'none',
  176. duration: 1000
  177. });
  178. }
  179. }).catch(response => {
  180. that.loading = false;
  181. uni.hideLoading();
  182. });
  183. },
  184. getList() {
  185. let that = this;
  186. if(that.loading) {
  187. return false
  188. }
  189. that.loading = true;
  190. that.$request({
  191. url: that.$api.app_admin.order,
  192. data: {
  193. status: that.activeTab,
  194. plugin: that.active.sign,
  195. page: that.page
  196. }
  197. }).then(response=>{
  198. that.loading = false;
  199. that.$hideLoading();
  200. uni.hideLoading();
  201. if(response.code == 0) {
  202. that.choose_list = response.plugin_list;
  203. response.data.list.forEach(function(row,index){
  204. if (row.created_at.substring(0,10) == that.today) {
  205. row.created_at = row.created_at.substring(11)
  206. } else if (row.created_at.substring(0, 10) == that.yesterday) {
  207. row.created_at = '昨天'
  208. }else {
  209. row.created_at = row.created_at.substring(0, 10)
  210. }
  211. })
  212. that.list = that.list.concat(response.data.list);
  213. that.page++;
  214. that.more_list = false;
  215. if (response.data.list.length == response.data.pagination.pageSize) {
  216. that.more_list = true;
  217. }
  218. }else {
  219. uni.showToast({
  220. title: response.msg,
  221. icon: 'none',
  222. duration: 1000
  223. });
  224. }
  225. }).catch(response => {
  226. that.loading = false;
  227. that.$hideLoading();
  228. uni.hideLoading();
  229. });
  230. },
  231. },
  232. onReachBottom() {
  233. if(this.more_list) {
  234. uni.showLoading({
  235. title: '加载更多...'
  236. });
  237. if (this.activeTab == 1) {
  238. this.getPut();
  239. } else {
  240. this.getList();
  241. }
  242. }
  243. },
  244. onLoad() {
  245. let that = this;
  246. that.$showLoading({
  247. type: 'global',
  248. text: '加载中...'
  249. });
  250. var myDate = new Date();
  251. // 今天
  252. let year = myDate.getFullYear();
  253. let month = myDate.getMonth() + 1;
  254. if (month >= 1 && month <= 9) {
  255. month = "0" + month;
  256. }
  257. let now = myDate.getDate();
  258. that.today = year + "-" + month + "-" + now;
  259. var timestamp = Date.parse(new Date());
  260. // 昨天
  261. let yesterTime = (timestamp / 1000 - 24 * 60 * 60) * 1000;
  262. let yesterDate = new Date(yesterTime)
  263. let yester_year = yesterDate.getFullYear();
  264. let yester_month = yesterDate.getMonth() + 1;
  265. if (yester_month >= 1 && yester_month <= 9) {
  266. yester_month = "0" + yester_month;
  267. }
  268. let yester_now = yesterDate.getDate();
  269. that.yesterday = yester_year + "-" + yester_month + "-" + yester_now;
  270. that.getList();
  271. }
  272. }
  273. </script>
  274. <style scoped lang="scss">
  275. .order-placeholder {
  276. height: #{74rpx};
  277. }
  278. .order {
  279. position: fixed;
  280. top: #{90rpx};
  281. left: 0;
  282. color: #446dfd;
  283. width: 100%;
  284. z-index: 9;
  285. background-color: #f7f7f7;
  286. padding: #{24rpx} 0;
  287. font-size: #{26rpx};
  288. >view {
  289. width: #{200rpx};
  290. height: #{50rpx};
  291. text-align: center;
  292. .more {
  293. margin-left: #{12rpx};
  294. width: #{22rpx};
  295. height: #{12rpx};
  296. display: block;
  297. }
  298. }
  299. }
  300. .plugin-name {
  301. border: #{2rpx} solid #ff9000;
  302. padding: 0 #{6rpx};
  303. background-color: #fff8ee;
  304. color: #ff9000;
  305. font-size: #{24rpx};
  306. height: #{36rpx};
  307. border-radius: #{8rpx};
  308. line-height: #{35rpx};
  309. margin-right: #{8rpx};
  310. }
  311. .dialog {
  312. position: fixed;
  313. height: 100%;
  314. width: 100%;
  315. bottom: 0;
  316. left: 0;
  317. z-index: 10;
  318. background-color: rgba(0, 0, 0, .3);
  319. .picker-list {
  320. background-color: #fff;
  321. padding-top: #{20rpx};
  322. position: fixed;
  323. bottom: 0;
  324. left: 0;
  325. width: 100%;
  326. }
  327. .picker-view {
  328. line-height: #{72rpx};
  329. text-align:center;
  330. font-size: #{32rpx};
  331. }
  332. .picker-view.sure-color {
  333. color: #446dfd;
  334. }
  335. .picker-view.cardinal-color {
  336. color: #999999;
  337. }
  338. .picker-view.even-color {
  339. color: #cdcdcd;
  340. }
  341. picker-view {
  342. width: 100%;
  343. height: #{440rpx};
  344. }
  345. .picker-header {
  346. padding: 0 #{24rpx};
  347. color: #446dfd;
  348. font-size: #{32rpx};
  349. }
  350. }
  351. .msg-item {
  352. margin: #{24rpx};
  353. margin-bottom: 0;
  354. border-radius: #{16rpx};
  355. background-color: #fff;
  356. padding: #{28rpx} #{20rpx} #{24rpx};
  357. position: relative;
  358. }
  359. .msg-title {
  360. color: #353535;
  361. font-size: #{28rpx};
  362. margin-bottom: #{20rpx};
  363. }
  364. .msg-time {
  365. position: absolute;
  366. right: #{20rpx};
  367. top: #{32rpx};
  368. color: #999999;
  369. font-size: #{24rpx};
  370. }
  371. .goods-info {
  372. height: #{144rpx};
  373. border-radius: #{8rpx};
  374. background-color: #f7f7f7;
  375. position: relative;
  376. padding: #{16rpx} #{20rpx} 0 0;
  377. }
  378. .goods-img {
  379. height: #{144rpx};
  380. width: #{144rpx};
  381. float: left;
  382. margin-right: #{20rpx};
  383. margin-top: #{-16rpx};
  384. }
  385. .goods-name {
  386. color: #353535;
  387. font-size: #{26rpx};
  388. }
  389. .goods-user {
  390. position: absolute;
  391. left: #{164rpx};
  392. bottom: #{20rpx};
  393. color: #999999;
  394. font-size: #{24rpx};
  395. }
  396. .replace {
  397. height: #{12rpx};
  398. width: #{12rpx};
  399. border-radius: 50%;
  400. background-color: #ffaa31;
  401. display: inline-block;
  402. margin-right: #{12rpx};
  403. }
  404. .return {
  405. height: #{12rpx};
  406. width: #{12rpx};
  407. border-radius: 50%;
  408. background-color: #ff4544;
  409. display: inline-block;
  410. margin-right: #{12rpx};
  411. }
  412. .top {
  413. padding:0 #{24rpx};
  414. background-color: #fff;
  415. border-bottom: #{1rpx} solid #E2E2E2;
  416. position: fixed;
  417. top: 0;
  418. left: 0;
  419. z-index: 10;
  420. width: 100%;
  421. }
  422. .no-tip {
  423. position: fixed;
  424. top: #{250rpx};
  425. left: 0;
  426. right: 0;
  427. margin: 0 auto;
  428. color: #666666;
  429. font-size: #{24rpx};
  430. width: #{240rpx};
  431. text-align: center;
  432. }
  433. .no-tip image {
  434. height: #{240rpx};
  435. width: #{240rpx};
  436. margin-bottom: #{20rpx};
  437. }
  438. </style>