order.vue 13 KB

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