order.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387
  1. <template>
  2. <app-layout>
  3. <view class="search-area">
  4. <view v-if="search.keyword || search.dateArr[0] || search.dateArr[1]" class="search be-search dir-left-nowrap" @click="toSearch">
  5. <image class="icon-search" src="/static/image/icon/icon-search.png"></image>
  6. <view v-if="search.dateArr[0]">{{search.dateArr[0]}}</view>
  7. <view v-if="search.dateArr[1]"><text v-if="search.dateArr[0]">至</text>{{search.dateArr[1]}}</view>
  8. <view v-if="search.keyword"><text v-if="search.dateArr[0] || search.dateArr[1]">,</text>{{search.keyword}}</view>
  9. </view>
  10. <view v-else class="search main-center" @click="toSearch">
  11. <image class="icon-search" src="/static/image/icon/icon-search.png"></image>
  12. <text>搜索</text>
  13. </view>
  14. </view>
  15. <app-tab-nav
  16. :tabList="tabList"
  17. :activeItem="activeTab"
  18. padding="0"
  19. @click="tabStatus"
  20. setTop="88"
  21. :border="false"
  22. :shadow="false"
  23. :theme="getTheme"
  24. ></app-tab-nav>
  25. <view class="list" style="margin-top: 100rpx;">
  26. <view class="item" v-for="item in list" :key="item.id" @click="toDetail(item.id)">
  27. <view class="item-top main-between">
  28. <text>订单号:{{item.order_no}}{{item.is_recommend?'[系统推荐]':''}}</text>
  29. <text>{{item.status}}</text>
  30. </view>
  31. <view class="order" v-for="goods in item.detail" :key="goods.id">
  32. <view @click="toGoods(goods.id,item)">
  33. <image class="goods-img" :src="goods.cover_pic"></image>
  34. <view class="t-omit goods-name">{{goods.name}}</view>
  35. <view style="color: #999999;"><text v-for="attr in goods.attr_list" :key="attr.attr_group_id">{{attr.attr_group_name}}:{{attr.attr_name}}</text></view>
  36. <view class="dir-left-nowrap">
  37. <view class="box-grow-1" style="color: #999999;">x{{goods.num}}</view>
  38. <view class="box-grow-0">¥{{goods.total_price}}</view>
  39. </view>
  40. </view>
  41. </view>
  42. <view @click="open(item.id)">
  43. <view class="item-bottom dir-left-nowrap">
  44. <image class="avatar" :src="item.avatar"></image>
  45. <view class="t-omit name">{{item.nickname}}</view>
  46. <view class="t-omit type">{{item.share_status}}</view>
  47. <view class="money">{{item.is_sale == 1 ? "已得佣金:" : "预计佣金:"}}
  48. <text class="red-color">{{item.share_money}}</text>元</view>
  49. </view>
  50. </view>
  51. </view>
  52. </view>
  53. </app-layout>
  54. </template>
  55. <script>
  56. import appTabNav from "../../../components/basic-component/app-tab-nav/app-tab-nav.vue";
  57. import appOrderGoodsInfo from '../../../components/page-component/app-order-goods-info/app-order-goods-info.vue';
  58. import { mapState,mapGetters } from "vuex";
  59. export default {
  60. data() {
  61. return {
  62. search: {
  63. keyword: '',
  64. dateArr: []
  65. },
  66. tabList: [ // 兼容处理
  67. {id:0, name: '全部'},
  68. {id:1, name: '待付款'},
  69. {id:4, name: '待发货'},
  70. {id:5, name: '待收货'},
  71. {id:3, name: '已完成'},
  72. {id:6, name: '售后中'},
  73. ],
  74. loading: null,
  75. list: [],
  76. activeTab: 0,
  77. id: null,
  78. page: 2,
  79. bgColor: '#f7f7f7',
  80. }
  81. },
  82. components: {
  83. "app-tab-nav": appTabNav,
  84. 'app-order-goods-info': appOrderGoodsInfo,
  85. },
  86. computed: {
  87. ...mapState({
  88. mall: state => state.mallConfig.mall,
  89. custom_setting: state => state.mallConfig.share_setting_custom,
  90. share_setting: state => state.mallConfig.share_setting,
  91. }),
  92. ...mapGetters('mallConfig', {
  93. tabBarNavs: 'getNavBar',
  94. getTheme: 'getTheme',
  95. })
  96. },
  97. methods: {
  98. toDetail(id){
  99. uni.navigateTo({
  100. url: `/pages/order/order-detail/order-detail?id=${id}&is_share=1`
  101. })
  102. },
  103. toSearch() {
  104. uni.navigateTo({
  105. url: `/pages/order/search/search`
  106. })
  107. },
  108. open(e) {
  109. if(this.id != e) {
  110. this.id = e;
  111. }else {
  112. this.id = null;
  113. }
  114. },
  115. tabStatus(e) {
  116. this.list = [];
  117. this.page = 2;
  118. this.activeTab = e.currentTarget.dataset.id;
  119. uni.showLoading({
  120. title: '加载中...'
  121. });
  122. this.getList();
  123. },
  124. getList() {
  125. let that = this;
  126. that.$request({
  127. url: that.$api.share.share_order,
  128. data: {
  129. status: that.activeTab,
  130. keyword: this.search ? this.search.keyword : '',
  131. dateArr: this.search ? JSON.stringify(this.search.dateArr) : JSON.stringify([]),
  132. },
  133. }).then(response=>{
  134. that.$hideLoading();
  135. uni.hideLoading();
  136. if(response.code == 0) {
  137. that.list = response.data.list;
  138. }else {
  139. uni.showToast({
  140. title: response.msg,
  141. icon: 'none',
  142. duration: 1000
  143. });
  144. }
  145. }).catch(() => {
  146. that.$hideLoading();
  147. uni.hideLoading();
  148. that.$event.on(that.$const.EVENT_USER_LOGIN).then(()=>{
  149. that.getList();
  150. });
  151. });
  152. },
  153. getMore() {
  154. let that = this;
  155. let url;
  156. uni.showLoading({
  157. title: '加载中...'
  158. });
  159. that.$request({
  160. url: that.$api.share.share_order,
  161. data: {
  162. status: that.activeTab,
  163. page: that.page
  164. },
  165. }).then(response=>{
  166. uni.hideLoading();
  167. if(response.code == 0) {
  168. if(response.data.list.length > 0) {
  169. that.loading = null;
  170. that.list = that.list.concat(response.data.list);
  171. that.page++;
  172. }
  173. }else {
  174. uni.showToast({
  175. title: response.msg,
  176. icon: 'none',
  177. duration: 1000
  178. });
  179. }
  180. }).catch(e => {
  181. uni.hideLoading();
  182. });
  183. },
  184. toGoods(id,item) {
  185. return true;
  186. if(item.mch_id > 0) {
  187. uni.navigateTo({
  188. url: '/plugins/mch/goods/goods?id=' + id +'&mch_id=' + item.mch_id
  189. });
  190. }else if(item.sign =='advance') {
  191. uni.navigateTo({
  192. url: '/plugins/advance/detail/detail?id=' + id
  193. });
  194. }else if(item.sign =='pintuan') {
  195. uni.navigateTo({
  196. url: '/plugins/pt/goods/goods?goods_id=' + id
  197. });
  198. }else if(item.sign =='miaosha') {
  199. uni.navigateTo({
  200. url: '/plugins/miaosha/goods/goods?id=' + id
  201. });
  202. } else if(item.sign =='gift') {
  203. uni.navigateTo({
  204. url: '/plugins/gift/goods/goods?id=' + id
  205. });
  206. } else if(item.sign =='advance') {
  207. uni.navigateTo({
  208. url: '/plugins/advance/detail/detail?id=' + item.goods_id
  209. });
  210. } else if(item.sign =='booking') {
  211. uni.navigateTo({
  212. url: '/plugins/book/goods/goods?goods_id=' + id
  213. });
  214. } else if(item.sign =='') {
  215. uni.navigateTo({
  216. url: '/pages/goods/goods?id=' + id
  217. });
  218. } else if(item.sign == 'vip_card') {
  219. return false
  220. }else {
  221. uni.navigateTo({
  222. url: '/plugins/'+item.sign+'/goods/goods?goods_id=' + id
  223. });
  224. }
  225. },
  226. },
  227. onLoad(options) {
  228. let that = this;
  229. uni.setNavigationBarTitle({
  230. title: that.custom_setting.menus.order.name
  231. });
  232. },
  233. onShow(){
  234. let that = this;
  235. uni.getStorage({
  236. key: 'search',
  237. success(res) {
  238. that.search = res.data;
  239. that.$showLoading({
  240. type: 'global',
  241. text: '加载中...'
  242. });
  243. that.getList();
  244. },
  245. fail() {
  246. that.$showLoading({
  247. type: 'global',
  248. text: '加载中...'
  249. });
  250. that.getList();
  251. }
  252. });
  253. },
  254. onReachBottom() {
  255. this.getMore();
  256. }
  257. }
  258. </script>
  259. <style scoped lang="scss">
  260. .search-area {
  261. position: fixed;
  262. z-index: 3;
  263. top: 0;
  264. left: 0;
  265. right: 0;
  266. height: #{88rpx};
  267. line-height: #{88rpx};
  268. width: 100%;
  269. background-color: #efeff4;
  270. padding: #{12rpx} #{24rpx};
  271. .search {
  272. height: #{64rpx};
  273. line-height: #{64rpx};
  274. border-radius: #{32rpx};
  275. background-color: #fff;
  276. color: #b2b2b2;
  277. font-size:#{26rpx};
  278. &.be-search {
  279. color: #353535;
  280. padding-left: 32rpx;
  281. .icon-search {
  282. margin-right: 10rpx;
  283. }
  284. }
  285. .icon-search {
  286. height: #{24rpx};
  287. width: #{24rpx};
  288. margin-top: #{20rpx};
  289. &+text {
  290. color: #b2b2b2;
  291. margin:0 #{8rpx};
  292. }
  293. }
  294. }
  295. }
  296. .item {
  297. background-color: #fff;
  298. color: #353535;
  299. padding: 0 #{24rpx};
  300. font-size: #{24rpx};
  301. margin: 0 #{24rpx} #{30rpx};
  302. border-radius: #{16rpx};
  303. box-shadow: 1rpx 1rpx 10rpx rgba(0, 0, 0, 0.06);
  304. }
  305. .status {
  306. float: right;
  307. }
  308. .item-top {
  309. padding: #{24rpx} 0;
  310. }
  311. .item-bottom {
  312. height: #{90rpx};
  313. line-height: #{66rpx};
  314. padding: #{12rpx} 0;
  315. }
  316. .avatar {
  317. height: #{64rpx};
  318. width: #{64rpx};
  319. float: left;
  320. margin-right: #{10rpx};
  321. }
  322. .item-bottom .name {
  323. width: 20%;
  324. }
  325. .item-bottom .type {
  326. width: 25%;
  327. margin-left: #{20rpx};
  328. }
  329. .item-bottom .money {
  330. width: 35%;
  331. text-align: right;
  332. }
  333. .open {
  334. float: right;
  335. margin: #{20rpx} #{10rpx} 0 #{20rpx};
  336. height: #{26rpx};
  337. width: #{16rpx};
  338. }
  339. .close {
  340. float: right;
  341. margin: #{25rpx} #{10rpx};
  342. height: #{16rpx};
  343. width: #{26rpx};
  344. }
  345. .order {
  346. border-top: #{1rpx} solid #e2e2e2;
  347. height: #{164rpx};
  348. padding: #{30rpx} 0;
  349. }
  350. .goods-img {
  351. height: #{104rpx};
  352. width: #{104rpx};
  353. margin-right: #{50rpx};
  354. float: left;
  355. }
  356. .goods-name {
  357. width: 75%;
  358. margin-bottom: #{5rpx};
  359. }
  360. .red-color {
  361. color: #ff4544;
  362. }
  363. </style>