order.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. <template>
  2. <app-layout>
  3. <app-tab-nav :tabList="tabList" :activeItem="activeTab" padding="0" @click="tabStatus" :theme="theme"></app-tab-nav>
  4. <view class="list">
  5. <view class="item" v-for="item in list" :key="item.id">
  6. <view class="item-top main-between">
  7. <text>订单号:{{item.order_no}}</text>
  8. <text :class="[`${theme}-color`]">{{item.status}}</text>
  9. </view>
  10. <view @click="open(item.id)">
  11. <view class="item-bottom dir-left-nowrap">
  12. <image class="avatar" :src="item.avatar"></image>
  13. <view class="t-omit name">{{item.nickname}}</view>
  14. <view class="t-omit type">{{item.share_status}}</view>
  15. <view class="money">{{item.is_sale == 1 ? "已得佣金:" : "预计佣金:"}}
  16. <text :class="[`${theme}-color`]">{{item.share_money}}</text>元</view>
  17. <image class="close" src="/static/image/share/img-share-down.png" v-if="id == item.id"></image>
  18. <image class="open" src="/static/image/share/img-share-right.png" v-else></image>
  19. </view>
  20. </view>
  21. <view class="order" v-if="id == item.id" v-for="goods in item.detail" :key="goods.id">
  22. <view @click="toGoods(goods.id,item)">
  23. <image class="goods-img" :src="goods.cover_pic"></image>
  24. <view class="t-omit goods-name">{{goods.name}}</view>
  25. <view><text v-for="attr in goods.attr_list" :key="attr.attr_group_id">{{attr.attr_group_name}}:{{attr.attr_name}}</text></view>
  26. <view>x{{goods.num}}</view>
  27. </view>
  28. </view>
  29. </view>
  30. </view>
  31. </app-layout>
  32. </template>
  33. <script>
  34. import appTabNav from "../../../components/basic-component/app-tab-nav/app-tab-nav.vue";
  35. import { mapState } from "vuex";
  36. export default {
  37. data() {
  38. return {
  39. tabList: [
  40. {id:0, name: '全部'},
  41. {id:1, name: '待付款'},
  42. {id:2, name: '已付款'},
  43. {id:3, name: '已完成'},
  44. ],
  45. loading: null,
  46. list: [],
  47. activeTab: 0,
  48. id: null,
  49. page: 2
  50. }
  51. },
  52. components: {
  53. "app-tab-nav": appTabNav,
  54. },
  55. computed: {
  56. ...mapState({
  57. theme: state => state.mallConfig.theme,
  58. mall: state => state.mallConfig.mall,
  59. custom_setting: state => state.mallConfig.share_setting_custom,
  60. share_setting: state => state.mallConfig.share_setting,
  61. })
  62. },
  63. methods: {
  64. open(e) {
  65. if(this.id != e) {
  66. this.id = e;
  67. }else {
  68. this.id = null;
  69. }
  70. },
  71. tabStatus(e) {
  72. this.list = [];
  73. this.page = 2;
  74. this.activeTab = e.currentTarget.dataset.id;
  75. uni.showLoading({
  76. title: '加载中...'
  77. });
  78. this.getList();
  79. },
  80. getList() {
  81. let that = this;
  82. that.$request({
  83. url: that.$api.share.share_order,
  84. data: {
  85. status: that.activeTab
  86. },
  87. }).then(response=>{
  88. that.$hideLoading();
  89. uni.hideLoading();
  90. if(response.code == 0) {
  91. that.list = response.data.list;
  92. }else {
  93. uni.showToast({
  94. title: response.msg,
  95. icon: 'none',
  96. duration: 1000
  97. });
  98. }
  99. }).catch(response => {
  100. that.$hideLoading();
  101. uni.hideLoading();
  102. that.$event.on(that.$const.EVENT_USER_LOGIN).then(()=>{
  103. that.getList();
  104. });
  105. });
  106. },
  107. getMore() {
  108. let that = this;
  109. let url;
  110. uni.showLoading({
  111. title: '加载中...'
  112. });
  113. that.$request({
  114. url: that.$api.share.share_order,
  115. data: {
  116. status: that.activeTab,
  117. page: that.page
  118. },
  119. }).then(response=>{
  120. uni.hideLoading();
  121. if(response.code == 0) {
  122. if(response.data.list.length > 0) {
  123. that.loading = null;
  124. that.list = that.list.concat(response.data.list);
  125. that.page++;
  126. }
  127. }else {
  128. uni.showToast({
  129. title: response.msg,
  130. icon: 'none',
  131. duration: 1000
  132. });
  133. }
  134. }).catch(e => {
  135. uni.hideLoading();
  136. });
  137. },
  138. toGoods(id,item) {
  139. if(item.mch_id > 0) {
  140. uni.navigateTo({
  141. url: '/plugins/mch/goods/goods?id=' + id +'&mch_id=' + item.mch_id
  142. });
  143. }else if(item.sign =='advance') {
  144. uni.navigateTo({
  145. url: '/plugins/advance/detail/detail?id=' + id
  146. });
  147. }else if(item.sign =='pintuan') {
  148. uni.navigateTo({
  149. url: '/plugins/pt/goods/goods?goods_id=' + id
  150. });
  151. }else if(item.sign =='miaosha') {
  152. uni.navigateTo({
  153. url: '/plugins/miaosha/goods/goods?id=' + id
  154. });
  155. } else if(item.sign =='gift') {
  156. uni.navigateTo({
  157. url: '/plugins/gift/goods/goods?id=' + id
  158. });
  159. } else if(item.sign =='advance') {
  160. uni.navigateTo({
  161. url: '/plugins/advance/detail/detail?id=' + item.goods_id
  162. });
  163. } else if(item.sign =='booking') {
  164. uni.navigateTo({
  165. url: '/plugins/book/goods/goods?goods_id=' + id
  166. });
  167. } else if(item.sign =='') {
  168. uni.navigateTo({
  169. url: '/pages/goods/goods?id=' + id
  170. });
  171. } else if(item.sign == 'vip_card') {
  172. return false
  173. }else {
  174. uni.navigateTo({
  175. url: '/plugins/'+item.sign+'/goods/goods?goods_id=' + id
  176. });
  177. }
  178. },
  179. },
  180. onLoad(options) {
  181. let that = this;
  182. uni.setNavigationBarTitle({
  183. title: that.custom_setting.menus.order.name
  184. });
  185. that.$showLoading({
  186. type: 'global',
  187. text: '加载中...'
  188. });
  189. that.getList();
  190. },
  191. onReachBottom() {
  192. this.getMore();
  193. }
  194. }
  195. </script>
  196. <style scoped lang="scss">
  197. .item {
  198. background-color: #fff;
  199. color: #353535;
  200. padding: 0 #{24rpx};
  201. font-size: #{24rpx};
  202. margin-bottom: #{30rpx};
  203. }
  204. .status {
  205. float: right;
  206. }
  207. .item-top {
  208. padding: #{24rpx} 0;
  209. border-bottom: #{1rpx} solid #e2e2e2;
  210. }
  211. .item-bottom {
  212. height: #{90rpx};
  213. line-height: #{66rpx};
  214. padding: #{12rpx} 0;
  215. }
  216. .avatar {
  217. height: #{64rpx};
  218. width: #{64rpx};
  219. float: left;
  220. margin-right: #{10rpx};
  221. }
  222. .item-bottom .name {
  223. width: 20%;
  224. }
  225. .item-bottom .type {
  226. width: 25%;
  227. margin-left: #{20rpx};
  228. }
  229. .item-bottom .money {
  230. width: 35%;
  231. text-align: right;
  232. }
  233. .open {
  234. float: right;
  235. margin: #{20rpx} #{10rpx} 0 #{20rpx};
  236. height: #{26rpx};
  237. width: #{16rpx};
  238. }
  239. .close {
  240. float: right;
  241. margin: #{25rpx} #{10rpx};
  242. height: #{16rpx};
  243. width: #{26rpx};
  244. }
  245. .order {
  246. border-top: #{1rpx} solid #e2e2e2;
  247. height: #{164rpx};
  248. padding: #{30rpx} 0;
  249. }
  250. .goods-img {
  251. height: #{104rpx};
  252. width: #{104rpx};
  253. margin-right: #{50rpx};
  254. float: left;
  255. }
  256. .goods-name {
  257. width: 75%;
  258. margin-bottom: #{5rpx};
  259. }
  260. </style>