index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450
  1. <template>
  2. <view class="pos-order-list" ref="container">
  3. <view class="nav acea-row row-around row-middle">
  4. <view class="item" :class="where.status == 1 ? 'on' : ''" @click="changeStatus(1)">
  5. 待付款
  6. </view>
  7. <view class="item" :class="where.status == 2 ? 'on' : ''" @click="changeStatus(2)">
  8. 待发货
  9. </view>
  10. <view class="item" :class="where.status == 3 ? 'on' : ''" @click="changeStatus(3)">
  11. 待收货
  12. </view>
  13. <view class="item" :class="where.status == 4 ? 'on' : ''" @click="changeStatus(4)">
  14. 待评价
  15. </view>
  16. <view class="item" :class="where.status == 5 ? 'on' : ''" @click="changeStatus(5)">
  17. 已完成
  18. </view>
  19. <view class="item" :class="where.status == 6 ? 'on' : ''" @click="changeStatus(6)">
  20. 退款
  21. </view>
  22. </view>
  23. <view class="list">
  24. <view class="item" v-for="(item, index) in list" :key="index">
  25. <view class="order-num acea-row row-middle">
  26. 订单号:{{ item.order_sn }}
  27. <span class="time">下单时间:{{ item.create_time }}</span>
  28. </view>
  29. <view class="pos-order-goods" v-for="(val, key) in item.orderProduct" :key="key" @click="toDetail(item)">
  30. <view class="goods acea-row row-between-wrapper">
  31. <view class="picTxt acea-row row-between-wrapper">
  32. <view class="pictrue">
  33. <image :src="val.cart_info.product.image" />
  34. </view>
  35. <view class="text acea-row row-between row-column">
  36. <view class="info line2">
  37. {{ val.cart_info.product.store_name }}
  38. </view>
  39. <view class="attr" v-if="val.cart_info.productAttr.sku">
  40. {{ val.cart_info.productAttr.sku }}
  41. </view>
  42. </view>
  43. </view>
  44. <view class="money">
  45. <view class="x-money">¥{{ val.cart_info.product.price }}</view>
  46. <view class="num">x{{ item.total_num }}</view>
  47. <view class="y-money">
  48. ¥{{ val.cart_info.productAttr.cost }}
  49. </view>
  50. </view>
  51. </view>
  52. </view>
  53. <view class="public-total">
  54. 共{{ item.total_num }}件商品,
  55. <span v-if="where.status <= 1">应</span>
  56. <span v-else>已</span>
  57. 支付
  58. <span class="money">¥{{ item.pay_price }}</span> ( 邮费 ¥{{
  59. item.total_postage
  60. }}
  61. )
  62. </view>
  63. <view class="operation acea-row row-between-wrapper">
  64. <view class="more">
  65. <!-- <view class="iconfont icon-gengduo" @click="more(index)"></view>-->
  66. <!-- <view class="order" v-show="current === index">-->
  67. <!-- <view class="items">-->
  68. <!-- {{ where.status > 0 ? "删除" : "取消" }}订单-->
  69. <!-- </view>-->
  70. <!-- <view class="arrow"></view>-->
  71. <!-- </view>-->
  72. </view>
  73. <view class="acea-row row-middle">
  74. <view class="bnt" @click="modify(item, 0)" v-if="where.status == 1">
  75. 一键改价
  76. </view>
  77. <view class="bnt" @click="modify(item, 1)">订单备注</view>
  78. <navigator class="bnt" v-if="where.status == 2 && item.order_type == 0" :url="'/pages/admin/delivery/index?id='+item.order_id">去发货
  79. </navigator>
  80. </view>
  81. </view>
  82. </view>
  83. </view>
  84. <Loading :loaded="loaded" :loading="loading"></Loading>
  85. <PriceChange :change="change" :orderInfo="orderInfo" v-on:closechange="changeclose($event)" v-on:savePrice="savePrice"
  86. :status="status"></PriceChange>
  87. </view>
  88. </template>
  89. <script>
  90. import {
  91. getOrderList,
  92. setAdminOrderPrice,
  93. setAdminOrderRemark,
  94. setOfflinePay,
  95. setOrderRefund
  96. } from "@/api/admin";
  97. import Loading from '@/components/Loading/index'
  98. import PriceChange from '@/components/PriceChange/index'
  99. import { isMoney } from '@/utils/validate.js'
  100. export default {
  101. name: "AdminOrderList",
  102. components: {
  103. Loading,
  104. PriceChange
  105. },
  106. data() {
  107. return {
  108. current: "",
  109. change: false,
  110. types: 1,
  111. where: {
  112. page: 1,
  113. limit: 10,
  114. status: 1
  115. },
  116. list: [],
  117. loaded: false,
  118. loading: false,
  119. orderInfo: {},
  120. status: ""
  121. };
  122. },
  123. watch: {
  124. "$route.params.types": function(newVal) {
  125. let that = this;
  126. if (newVal != undefined) {
  127. that.where.status = newVal;
  128. that.init();
  129. }
  130. },
  131. types: function() {
  132. this.getIndex();
  133. }
  134. },
  135. onLoad(option) {
  136. this.where.status = option.types
  137. this.current = "";
  138. this.getIndex();
  139. },
  140. methods: {
  141. // 获取数据
  142. getIndex: function() {
  143. let that = this;
  144. if (that.loading || that.loaded) return;
  145. that.loading = true;
  146. getOrderList(that.where).then(
  147. res => {
  148. that.loading = false;
  149. that.loaded = res.data.list.length < that.where.limit;
  150. that.list.push.apply(that.list, res.data.list);
  151. that.where.page = that.where.page + 1;
  152. },
  153. err => {
  154. that.$dialog.message(error.msg);
  155. }
  156. );
  157. },
  158. // 初始化
  159. init: function() {
  160. this.list = [];
  161. this.where.page = 1;
  162. this.loaded = false;
  163. this.loading = false;
  164. this.getIndex();
  165. this.current = "";
  166. },
  167. // 导航切换
  168. changeStatus(val) {
  169. if (this.where.status != val) {
  170. this.where.status = val;
  171. this.init();
  172. }
  173. },
  174. // 商品操作
  175. modify: function(item, status) {
  176. let temp = status.toString()
  177. this.change = true;
  178. this.orderInfo = item;
  179. this.status = temp;
  180. },
  181. changeclose: function(msg) {
  182. this.change = msg;
  183. },
  184. async savePrice(opt) {
  185. let that = this,
  186. data = {},
  187. price = opt.orderInfo.pay_postage,
  188. refund_price = opt.refund_price,
  189. refund_status = that.orderInfo.refund_status,
  190. remark = opt.remark;
  191. let parmas = {
  192. pay_postage: opt.orderInfo.pay_postage,
  193. coupon_price: opt.orderInfo.coupon_price,
  194. total_price: Number(opt.orderInfo.total_price)
  195. }
  196. let id = that.orderInfo.order_id;
  197. if (that.status == 0) {
  198. if(!isMoney(opt.orderInfo.pay_postage || opt.orderInfo.total_price)){
  199. return that.$util.Tips({title: '请输入正确的金额'});
  200. }
  201. data.pay_price = price;
  202. setAdminOrderPrice(id,parmas).then(
  203. function() {
  204. that.change = false;
  205. that.$util.Tips({
  206. title:'改价成功',
  207. icon:'success'
  208. })
  209. that.init();
  210. },
  211. function(res) {
  212. that.change = false;
  213. that.$util.Tips({
  214. title:res,
  215. icon:'none'
  216. })
  217. }
  218. );
  219. } else {
  220. if(!remark){
  221. return this.$util.Tips({
  222. title:'请输入备注'
  223. })
  224. }
  225. setAdminOrderRemark(id, {remark: remark}).then(
  226. res => {
  227. that.change = false;
  228. this.$util.Tips({
  229. title:res.message,
  230. icon:'success'
  231. })
  232. that.init();
  233. },
  234. err => {
  235. that.change = false;
  236. that.$util.Tips({title: err});
  237. }
  238. );
  239. }
  240. },
  241. toDetail(item){
  242. uni.navigateTo({
  243. url:`/pages/admin/orderDetail/index?id=${item.order_id}`
  244. })
  245. }
  246. },
  247. onReachBottom() {
  248. this.getIndex()
  249. }
  250. }
  251. </script>
  252. <style>
  253. .pos-order-list .nav {
  254. width: 100%;
  255. height: 96upx;
  256. background-color: #fff;
  257. font-size: 30upx;
  258. color: #282828;
  259. position: fixed;
  260. top: 0;
  261. left: 0;
  262. z-index: 9999;
  263. }
  264. .pos-order-list .nav .item.on {
  265. color: #2291f8;
  266. }
  267. .pos-order-list .list {
  268. margin-top: 120upx;
  269. }
  270. .pos-order-list .list .item {
  271. background-color: #fff;
  272. width: 100%;
  273. }
  274. .pos-order-list .list .item~.item {
  275. margin-top: 24upx;
  276. }
  277. .pos-order-list .list .item .order-num {
  278. height: 124upx;
  279. border-bottom: 1px solid #eee;
  280. font-size: 30upx;
  281. font-weight: bold;
  282. color: #282828;
  283. padding: 0 30upx;
  284. }
  285. .pos-order-list .list .item .order-num .time {
  286. font-size: 26upx;
  287. font-weight: normal;
  288. color: #999;
  289. margin-top: -40upx;
  290. }
  291. .pos-order-list .list .item .operation {
  292. padding: 20upx 30upx;
  293. margin-top: 3upx;
  294. }
  295. .pos-order-list .list .item .operation .more {
  296. position: relative;
  297. }
  298. .pos-order-list .list .item .operation .icon-gengduo {
  299. font-size: 50upx;
  300. color: #aaa;
  301. }
  302. .pos-order-list .list .item .operation .order .arrow {
  303. width: 0;
  304. height: 0;
  305. border-left: 11upx solid transparent;
  306. border-right: 11upx solid transparent;
  307. border-top: 20upx solid #e5e5e5;
  308. position: absolute;
  309. left: 15upx;
  310. bottom: -18upx;
  311. }
  312. .pos-order-list .list .item .operation .order .arrow:before {
  313. content: '';
  314. width: 0;
  315. height: 0;
  316. border-left: 7upx solid transparent;
  317. border-right: 7upx solid transparent;
  318. border-top: 20upx solid #fff;
  319. position: absolute;
  320. left: -7upx;
  321. bottom: 0;
  322. }
  323. .pos-order-list .list .item .operation .order {
  324. width: 200upx;
  325. background-color: #fff;
  326. border: 1px solid #eee;
  327. border-radius: 10upx;
  328. position: absolute;
  329. top: -100upx;
  330. z-index: 9;
  331. }
  332. .pos-order-list .list .item .operation .order .items {
  333. height: 77upx;
  334. line-height: 77upx;
  335. text-align: center;
  336. }
  337. .pos-order-list .list .item .operation .order .items~.items {
  338. border-top: 1px solid #f5f5f5;
  339. }
  340. .pos-order-list .list .item .operation .bnt {
  341. font-size: 28upx;
  342. color: #5c5c5c;
  343. width: 170upx;
  344. height: 60upx;
  345. border-radius: 30upx;
  346. border: 1px solid #bbb;
  347. text-align: center;
  348. line-height: 60upx;
  349. }
  350. .pos-order-list .list .item .operation .bnt~.bnt {
  351. margin-left: 14upx;
  352. }
  353. .pos-order-goods {
  354. padding: 0 30upx;
  355. background-color: #fff;
  356. }
  357. .pos-order-goods .goods {
  358. height: 185upx;
  359. }
  360. .pos-order-goods .goods~.goods {
  361. border-top: 1px dashed #e5e5e5;
  362. }
  363. .pos-order-goods .goods .picTxt {
  364. width: 515upx;
  365. }
  366. .pos-order-goods .goods .picTxt .pictrue {
  367. width: 130upx;
  368. height: 130upx;
  369. }
  370. .pos-order-goods .goods .picTxt .pictrue image {
  371. width: 100%;
  372. height: 100%;
  373. border-radius: 6upx;
  374. }
  375. .pos-order-goods .goods .picTxt .text {
  376. flex-direction: column;
  377. width: 365upx;
  378. }
  379. .pos-order-goods .goods .picTxt .text .info {
  380. font-size: 28upx;
  381. color: #282828;
  382. }
  383. .pos-order-goods .goods .picTxt .text .attr {
  384. margin-top: 5rpx;
  385. font-size: 24upx;
  386. color: #999;
  387. }
  388. .pos-order-goods .goods .money {
  389. width: 164upx;
  390. text-align: right;
  391. font-size: 28upx;
  392. }
  393. .pos-order-goods .goods .money .x-money {
  394. color: #282828;
  395. }
  396. .pos-order-goods .goods .money .num {
  397. color: #ff9600;
  398. margin: 5upx 0;
  399. }
  400. .pos-order-goods .goods .money .y-money {
  401. color: #999;
  402. text-decoration: line-through;
  403. }
  404. .public-total {
  405. font-size: 28upx;
  406. color: #282828;
  407. border-top: 1px solid #eee;
  408. height: 92upx;
  409. line-height: 92upx;
  410. text-align: right;
  411. padding: 0 30upx;
  412. background-color: #fff;
  413. }
  414. .public-total .money {
  415. color: #ff4c3c;
  416. }
  417. </style>