profit.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396
  1. <template>
  2. <app-layout>
  3. <app-tab-nav :setTop="0" :tabList="tabList" :padding="0" :theme="getTheme" :activeItem="activeTab" @click="tabStatus" :shadow="false"></app-tab-nav>
  4. <view v-if="activeTab == 1">
  5. <view class="tip">提示:当预计利润大于可提现利润时,说明存在未过售后订单</view>
  6. <view class="tip-placeholder"></view>
  7. <view class="item" v-for="(item,index) in list" :key="index">
  8. <view class="item-top main-between">
  9. <view class="goods-title dir-left-nowrap">
  10. <image src="./../image/activity-name.png"></image>
  11. <view>{{item.activity.title}}</view>
  12. </view>
  13. <view class="start-time dir-left-nowrap">
  14. {{item.activity.start_at}}开始
  15. </view>
  16. </view>
  17. <view class="item-info">
  18. <view class="item-bottom main-center">
  19. <view class="money-item dir-top-nowrap cross-center main-center box-grow-1">
  20. <view>订单数</view>
  21. <view style="color: #353535;" class="money">{{item.order_num}}</view>
  22. </view>
  23. <view class="money-item dir-top-nowrap cross-center main-center box-grow-1">
  24. <view>订单金额</view>
  25. <view style="color: #353535;" class="money">{{item.total_pay_price}}</view>
  26. </view>
  27. </view>
  28. <view class="item-bottom main-center">
  29. <view class="money-item dir-top-nowrap cross-center main-center box-grow-1">
  30. <view>预计总利润</view>
  31. <view style="color: #f39800" class="money">{{item.profit_price}}</view>
  32. </view>
  33. <view class="money-item dir-top-nowrap cross-center main-center box-grow-1">
  34. <view>可提现利润</view>
  35. <view style="color: #f39800" class="money">{{item.stay_price}}</view>
  36. </view>
  37. </view>
  38. </view>
  39. </view>
  40. </view>
  41. <view v-if="activeTab == 2">
  42. <view class="price main-between cross-center">
  43. <view>
  44. <view>累计利润:¥{{statics.all_price ? statics.all_price :'0.00'}}</view>
  45. <view>待结算:¥{{statics.stay_price ? statics.stay_price: '0.00'}}</view>
  46. </view>
  47. <view class="choose-btn" :style="{'color': getTheme.color, 'border-color': getTheme.border}" @click="show=!show">
  48. <text>{{type == 'day' ? '今日': type == 'month' ? '本月': '全部'}}</text>
  49. <image v-if="activeTab == 2" :style="{'background-color': getTheme.background}" src='./../image/open.png'></image>
  50. </view>
  51. </view>
  52. <view class="order">
  53. <view v-for="item in detail" class="order-item" :key="item.order_no">
  54. <view class="order-top main-between">
  55. <view>{{item.order_no}}</view>
  56. <view>¥{{item.profit_price}}</view>
  57. </view>
  58. <view class="order-bottom main-between">
  59. <view>{{item.created_at}}</view>
  60. <view>{{item.status}}</view>
  61. </view>
  62. </view>
  63. </view>
  64. </view>
  65. <view class="bg" v-if="show">
  66. <view class='dialog'>
  67. <view @click="toggle('')" class="dialog-item">全部</view>
  68. <view @click="toggle('month')" class="dialog-item">本月</view>
  69. <view @click="toggle('day')" class="dialog-item">今日</view>
  70. <view class="cancel main-center cross-center">
  71. <view @click="show=!show" class="cancel-btn">取消</view>
  72. </view>
  73. </view>
  74. </view>
  75. </app-layout>
  76. </template>
  77. <script>
  78. import {mapGetters, mapState} from 'vuex';
  79. import appTabNav from "../../../components/basic-component/app-tab-nav/app-tab-nav.vue";
  80. export default {
  81. data() {
  82. return {
  83. show: false,
  84. statics: {
  85. all_price: '',
  86. stay_price: '',
  87. },
  88. tabList: [
  89. {id:1, name: '概况'},
  90. {id:2, name: '明细'}
  91. ],
  92. activeTab: 1,
  93. type: '',
  94. page: 1,
  95. list: [],
  96. detail: []
  97. }
  98. },
  99. components: {
  100. "app-tab-nav": appTabNav
  101. },
  102. computed: {
  103. ...mapGetters('mallConfig', {
  104. getTheme: 'getTheme',
  105. }),
  106. ...mapState({
  107. stock: state => state.mallConfig.__wxapp_img.stock,
  108. bonusImg: state => state.mallConfig.__wxapp_img.bonus,
  109. userInfo: state => state.user.info,
  110. })
  111. },
  112. onLoad(options) { this.$commonLoad.onload(options);
  113. this.$showLoading({
  114. type: 'global',
  115. text: '加载中...'
  116. });
  117. this.getStatus();
  118. },
  119. onReachBottom() {
  120. this.page++;
  121. if(this.activeTab == 2) {
  122. this.getDetail();
  123. }else {
  124. this.getList();
  125. }
  126. },
  127. methods: {
  128. tabStatus(e) {
  129. let id = e.currentTarget.dataset.id;
  130. this.show = false;
  131. this.activeTab = id;
  132. this.page = 1;
  133. if(this.detail.length == 0) {
  134. this.$showLoading({
  135. type: 'global',
  136. text: '加载中...'
  137. });
  138. }
  139. if(this.activeTab == 2) {
  140. this.getDetail();
  141. }else {
  142. this.getList();
  143. }
  144. },
  145. toggle(type) {
  146. this.type = type;
  147. this.show = false;
  148. this.page = 1;
  149. this.getDetail();
  150. },
  151. getDetail() {
  152. let that = this;
  153. that.$request({
  154. url: that.$api.community.profit_detail,
  155. data: {
  156. type: this.type,
  157. page: this.page
  158. }
  159. }).then(response=>{
  160. uni.hideLoading();
  161. that.$hideLoading();
  162. if(response.code == 0) {
  163. that.statics = response.data.data;
  164. if(that.page > 1) {
  165. that.detail = that.detail.concat(response.data.list);
  166. }else {
  167. that.detail = response.data.list;
  168. }
  169. }else {
  170. uni.showToast({
  171. title: response.msg,
  172. icon: 'none',
  173. duration: 1000
  174. });
  175. }
  176. }).catch(response => {
  177. uni.hideLoading();
  178. that.$hideLoading();
  179. });
  180. },
  181. getList() {
  182. let that = this;
  183. that.$request({
  184. url: that.$api.community.profit_list,
  185. data: {
  186. page: this.page
  187. }
  188. }).then(response=>{
  189. uni.hideLoading();
  190. that.$hideLoading();
  191. if(response.code == 0) {
  192. if(that.page > 1) {
  193. that.list = that.list.concat(response.list);
  194. }else {
  195. that.list = response.list;
  196. }
  197. }else {
  198. uni.showToast({
  199. title: response.msg,
  200. icon: 'none',
  201. duration: 1000
  202. });
  203. }
  204. }).catch(response => {
  205. uni.hideLoading();
  206. that.$hideLoading();
  207. });
  208. },
  209. getStatus() {
  210. let that = this;
  211. that.$request({
  212. url: that.$api.community.index,
  213. }).then(response=>{
  214. if(response.code == 0) {
  215. this.setting = response.data.setting;
  216. if(response.data.middleman.id > 0) {
  217. this.middleman = response.data.middleman;
  218. this.apply_at = this.middleman.apply_at.substring(0,10)
  219. this.getList();
  220. }else {
  221. uni.showToast({
  222. title: '您还不是团长,现在前往申请页面',
  223. icon: 'none',
  224. duration: 1000
  225. });
  226. setTimeout(function(){
  227. uni.redirectTo({
  228. url: '/plugins/community/apply/apply'
  229. });
  230. },1000)
  231. }
  232. }else {
  233. uni.showToast({
  234. title: response.msg,
  235. icon: 'none',
  236. duration: 1000
  237. });
  238. }
  239. }).catch(response => {
  240. that.$hideLoading();
  241. });
  242. }
  243. }
  244. }
  245. </script>
  246. <style scoped lang="scss">
  247. .tip {
  248. height: 60rpx;
  249. line-height: 60rpx;
  250. background-color: #f8e5e5;
  251. color: #ff4544;
  252. padding-left: 20rpx;
  253. font-size: 24rpx;
  254. position: fixed;
  255. top: #{90rpx};
  256. left: 0;
  257. width: 100%;
  258. z-index: 10;
  259. }
  260. .tip-placeholder {
  261. height: 60rpx;
  262. }
  263. .item {
  264. width: 702rpx;
  265. margin: 16rpx 24rpx 0;
  266. background-color: #fff;
  267. border-radius: 16rpx;
  268. .item-top {
  269. height: 90rpx;
  270. line-height: 90rpx;
  271. padding: 0 20rpx;
  272. border-bottom: 2rpx solid #e2e2e2;
  273. .goods-title {
  274. color: #353535;
  275. font-size: #{24rpx};
  276. margin-top: 30rpx;
  277. height: 30rpx;
  278. line-height: 30rpx;
  279. image {
  280. width: 30rpx;
  281. height: 30rpx;
  282. margin-right: 20rpx;
  283. display: block;
  284. }
  285. }
  286. .start-time {
  287. color: #999999;
  288. font-size: 24rpx;
  289. }
  290. }
  291. .item-info {
  292. padding: 30rpx 0;
  293. .item-bottom {
  294. height: 105rpx;
  295. .money-item {
  296. font-size: 24rpx;
  297. color: #999999;
  298. width: 50%;
  299. .money {
  300. margin-top: 10rpx;
  301. font-family: DIN;
  302. font-size: 46rpx;
  303. }
  304. }
  305. }
  306. }
  307. }
  308. .price {
  309. height: 96rpx;
  310. background-color: #fff;
  311. padding: 0 24rpx;
  312. font-size: 24rpx;
  313. color: #999999;
  314. position: fixed;
  315. top: #{90rpx};
  316. left: 0;
  317. width: 100%;
  318. z-index: 100;
  319. .choose-btn {
  320. border: 2rpx solid;
  321. height: 50rpx;
  322. border-radius: 25rpx;
  323. line-height: 48rpx;
  324. display: inline-block;
  325. padding: 0 24rpx;
  326. image {
  327. margin-top: 21rpx;
  328. height: 8rpx;
  329. width: 12rpx;
  330. margin-left: 10rpx;
  331. float: right;
  332. display: block;
  333. }
  334. }
  335. }
  336. .order {
  337. width: 702rpx;
  338. border-radius: 16rpx;
  339. background-color: #fff;
  340. margin: 114rpx 24rpx 24rpx;
  341. .order-item {
  342. padding: 24rpx 32rpx;
  343. border-top: 2rpx solid #e2e2e2;
  344. font-size: 26rpx;
  345. color: #353535;
  346. &:first-of-type {
  347. border-top: 0;
  348. }
  349. .order-bottom {
  350. font-size: 24rpx;
  351. color: #999999;
  352. }
  353. }
  354. }
  355. .bg {
  356. position: fixed;
  357. top: 0;
  358. left: 0;
  359. background-color: rgba(0,0,0,.3);
  360. z-index: 4;
  361. width: 100%;
  362. height: 100%;
  363. .dialog {
  364. background-color: #fff;
  365. border-radius: 16rpx;
  366. position: fixed;
  367. bottom: 0;
  368. left: 0;
  369. width: 100%;
  370. z-index: 200;
  371. .dialog-item {
  372. height: 115rpx;
  373. line-height: 115rpx;
  374. border-bottom: 2rpx solid #e2e2e2;
  375. text-align: center;
  376. font-size: 26rpx;
  377. color: #353535;
  378. }
  379. .cancel {
  380. background-color: #F6F6F6;
  381. height: 140rpx;
  382. .cancel-btn {
  383. height: 115rpx;
  384. line-height: 115rpx;
  385. text-align: center;
  386. width: 702rpx;
  387. border-radius: 16rpx;
  388. background-color: #fff;
  389. }
  390. }
  391. }
  392. }
  393. </style>