order.vue 13 KB

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