order-message.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441
  1. <template>
  2. <app-layout>
  3. <app-tab-nav :tabList="tabList" padding="0" :activeItem="activeTab" @click="tabStatus" theme="app-admin"></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">
  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. today: '',
  78. yesterday: '',
  79. active: {
  80. sign: 'all',
  81. name: '全部',
  82. },
  83. num: {}
  84. }
  85. },
  86. components: {
  87. "app-tab-nav": appTabNav,
  88. },
  89. computed: {
  90. ...mapState({
  91. theme: state => state.mallConfig.theme,
  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. if (this.activeTab == 1) {
  132. this.getPut();
  133. } else {
  134. this.getList();
  135. }
  136. },
  137. getPut() {
  138. let that = this;
  139. uni.showLoading({
  140. title: '加载中...'
  141. });
  142. that.$request({
  143. url: that.$api.app_admin.refund,
  144. data: {
  145. status: 0,
  146. sign: that.active.sign,
  147. page: that.page
  148. }
  149. }).then(response=>{
  150. uni.hideLoading();
  151. if(response.code == 0) {
  152. response.data.list.forEach(function(row,index){
  153. if (row.created_at.substring(0,10) == that.today) {
  154. row.created_at = row.created_at.substring(11)
  155. } else if (row.created_at.substring(0, 10) == that.yesterday) {
  156. row.created_at = '昨天'
  157. }else {
  158. row.created_at = row.created_at.substring(0, 10)
  159. }
  160. })
  161. that.list = that.list.concat(response.data.list);
  162. that.page++;
  163. that.more_list = false;
  164. if (that.list.length == response.data.pagination.pageSize) {
  165. that.more_list = true;
  166. }
  167. }else {
  168. uni.showToast({
  169. title: response.msg,
  170. icon: 'none',
  171. duration: 1000
  172. });
  173. }
  174. }).catch(response => {
  175. uni.hideLoading();
  176. });
  177. },
  178. getList() {
  179. let that = this;
  180. that.$request({
  181. url: that.$api.app_admin.order,
  182. data: {
  183. status: that.activeTab,
  184. plugin: that.active.sign,
  185. page: that.page
  186. }
  187. }).then(response=>{
  188. that.$hideLoading();
  189. uni.hideLoading();
  190. if(response.code == 0) {
  191. that.choose_list = response.plugin_list;
  192. response.data.list.forEach(function(row,index){
  193. if (row.created_at.substring(0,10) == that.today) {
  194. row.created_at = row.created_at.substring(11)
  195. } else if (row.created_at.substring(0, 10) == that.yesterday) {
  196. row.created_at = '昨天'
  197. }else {
  198. row.created_at = row.created_at.substring(0, 10)
  199. }
  200. })
  201. that.list = that.list.concat(response.data.list);
  202. that.page++;
  203. that.more_list = false;
  204. if (that.list.length == response.data.pagination.pageSize) {
  205. that.more_list = true;
  206. }
  207. }else {
  208. uni.showToast({
  209. title: response.msg,
  210. icon: 'none',
  211. duration: 1000
  212. });
  213. }
  214. }).catch(response => {
  215. that.$hideLoading();
  216. uni.hideLoading();
  217. });
  218. },
  219. },
  220. onReachBottom() {
  221. if(this.more_list) {
  222. this.getList();
  223. }
  224. },
  225. onLoad() {
  226. let that = this;
  227. that.$showLoading({
  228. type: 'global',
  229. text: '加载中...'
  230. });
  231. var myDate = new Date();
  232. // 今天
  233. let year = myDate.getFullYear();
  234. let month = myDate.getMonth() + 1;
  235. if (month >= 1 && month <= 9) {
  236. month = "0" + month;
  237. }
  238. let now = myDate.getDate();
  239. that.today = year + "-" + month + "-" + now;
  240. var timestamp = Date.parse(new Date());
  241. // 昨天
  242. let yesterTime = (timestamp / 1000 - 24 * 60 * 60) * 1000;
  243. let yesterDate = new Date(yesterTime)
  244. let yester_year = yesterDate.getFullYear();
  245. let yester_month = yesterDate.getMonth() + 1;
  246. if (yester_month >= 1 && yester_month <= 9) {
  247. yester_month = "0" + yester_month;
  248. }
  249. let yester_now = yesterDate.getDate();
  250. that.yesterday = yester_year + "-" + yester_month + "-" + yester_now;
  251. that.getList();
  252. }
  253. }
  254. </script>
  255. <style scoped lang="scss">
  256. .order-placeholder {
  257. height: #{74rpx};
  258. }
  259. .order {
  260. position: fixed;
  261. top: #{90rpx};
  262. left: 0;
  263. color: #446dfd;
  264. width: 100%;
  265. z-index: 9;
  266. background-color: #f7f7f7;
  267. padding: #{24rpx} 0;
  268. font-size: #{26rpx};
  269. >view {
  270. width: #{200rpx};
  271. height: #{50rpx};
  272. text-align: center;
  273. .more {
  274. margin-left: #{12rpx};
  275. width: #{22rpx};
  276. height: #{12rpx};
  277. display: block;
  278. }
  279. }
  280. }
  281. .plugin-name {
  282. border: #{2rpx} solid #ff9000;
  283. padding: 0 #{6rpx};
  284. background-color: #fff8ee;
  285. color: #ff9000;
  286. font-size: #{24rpx};
  287. height: #{36rpx};
  288. border-radius: #{8rpx};
  289. line-height: #{35rpx};
  290. margin-right: #{8rpx};
  291. }
  292. .dialog {
  293. position: fixed;
  294. height: 100%;
  295. width: 100%;
  296. bottom: 0;
  297. left: 0;
  298. z-index: 10;
  299. background-color: rgba(0, 0, 0, .3);
  300. .picker-list {
  301. background-color: #fff;
  302. padding-top: #{20rpx};
  303. position: fixed;
  304. bottom: 0;
  305. left: 0;
  306. width: 100%;
  307. }
  308. .picker-view {
  309. line-height: #{72rpx};
  310. text-align:center;
  311. font-size: #{32rpx};
  312. }
  313. .picker-view.sure-color {
  314. color: #446dfd;
  315. }
  316. .picker-view.cardinal-color {
  317. color: #999999;
  318. }
  319. .picker-view.even-color {
  320. color: #cdcdcd;
  321. }
  322. picker-view {
  323. width: 100%;
  324. height: #{440rpx};
  325. }
  326. .picker-header {
  327. padding: 0 #{24rpx};
  328. color: #446dfd;
  329. font-size: #{32rpx};
  330. }
  331. }
  332. .msg-item {
  333. margin: #{24rpx};
  334. margin-bottom: 0;
  335. border-radius: #{16rpx};
  336. background-color: #fff;
  337. padding: #{28rpx} #{20rpx} #{24rpx};
  338. position: relative;
  339. }
  340. .msg-title {
  341. color: #353535;
  342. font-size: #{28rpx};
  343. margin-bottom: #{20rpx};
  344. }
  345. .msg-time {
  346. position: absolute;
  347. right: #{20rpx};
  348. top: #{32rpx};
  349. color: #999999;
  350. font-size: #{24rpx};
  351. }
  352. .goods-info {
  353. height: #{144rpx};
  354. border-radius: #{8rpx};
  355. background-color: #f7f7f7;
  356. position: relative;
  357. padding: #{16rpx} #{20rpx} 0 0;
  358. }
  359. .goods-img {
  360. height: #{144rpx};
  361. width: #{144rpx};
  362. float: left;
  363. margin-right: #{20rpx};
  364. margin-top: #{-16rpx};
  365. }
  366. .goods-name {
  367. color: #353535;
  368. font-size: #{26rpx};
  369. }
  370. .goods-user {
  371. position: absolute;
  372. left: #{164rpx};
  373. bottom: #{20rpx};
  374. color: #999999;
  375. font-size: #{24rpx};
  376. }
  377. .replace {
  378. height: #{12rpx};
  379. width: #{12rpx};
  380. border-radius: 50%;
  381. background-color: #ffaa31;
  382. display: inline-block;
  383. margin-right: #{12rpx};
  384. }
  385. .return {
  386. height: #{12rpx};
  387. width: #{12rpx};
  388. border-radius: 50%;
  389. background-color: #ff4544;
  390. display: inline-block;
  391. margin-right: #{12rpx};
  392. }
  393. .top {
  394. padding:0 #{24rpx};
  395. background-color: #fff;
  396. border-bottom: #{1rpx} solid #E2E2E2;
  397. position: fixed;
  398. top: 0;
  399. left: 0;
  400. z-index: 10;
  401. width: 100%;
  402. }
  403. .no-tip {
  404. position: fixed;
  405. top: #{250rpx};
  406. left: 0;
  407. right: 0;
  408. margin: 0 auto;
  409. color: #666666;
  410. font-size: #{24rpx};
  411. width: #{240rpx};
  412. text-align: center;
  413. }
  414. .no-tip image {
  415. height: #{240rpx};
  416. width: #{240rpx};
  417. margin-bottom: #{20rpx};
  418. }
  419. </style>