order.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351
  1. <template>
  2. <app-layout>
  3. <view class="search">
  4. <view @click="toSearch=!toSearch" v-if="!toSearch" class="main-center search-content cross-center">
  5. <image src="/static/image/icon/icon-search.png"></image>
  6. <text>搜索</text>
  7. </view>
  8. <view v-else class="dir-left-norwap cross-center search-area" >
  9. <view class="search-input">
  10. <image src="/static/image/icon/icon-search.png"></image>
  11. <input :focus="!haveKeyword" @confirm="getList" confirm-type="search" v-model="keyword" placeholder-style="color:#999999;font-size:13px;" placeholder="请输入订单号或昵称搜索"></input>
  12. </view>
  13. <view class="cancel" @click="cancelSeacrch">取消</view>
  14. </view>
  15. </view>
  16. <app-tab-nav setTop="88" :tabList="tabList" :activeItem="activeTab" padding="0" @click="tabStatus" :theme="theme"></app-tab-nav>
  17. <view class="placeholder"></view>
  18. <view class="list" v-if="list && list.length > 0">
  19. <view v-for="item in list" :key="item.id" class="order-item">
  20. <view class="order-no">订单号 {{item.order_no}}</view>
  21. <view class="main-between cross-center">
  22. <view class="goods-item dir-left-nowrap">
  23. <image class="goods-img" :src="item.avatar"></image>
  24. <view class="t-omit order-nickname">{{item.nickname}}</view>
  25. </view>
  26. <view class="bonus-info">
  27. <view class="goods-price">商品金额
  28. <text>¥{{item.total_pay_price}}</text>
  29. </view>
  30. <view class="bonus-price">{{setting.form.price_text ? setting.form.price_text :"分红金额"}}
  31. <text>¥{{item.bonus_price}}</text>
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. <view class='no-tip' v-if="list && list.length == 0">
  38. <image src="/static/image/order-empty.png"></image>
  39. <span>暂无{{activeTab == 1?'未完成':activeTab == 2?'已完成':''}}订单</span>
  40. </view>
  41. </app-layout>
  42. </template>
  43. <script>
  44. import appTabNav from "../../../components/basic-component/app-tab-nav/app-tab-nav.vue";
  45. import { mapState } from "vuex";
  46. export default {
  47. data() {
  48. return {
  49. theme: {
  50. color: '#ff4544'
  51. },
  52. tabList: [
  53. {id:1, name: '未完成'},
  54. {id:2, name: '已完成'}
  55. ],
  56. loading: null,
  57. list: [],
  58. activeTab: 1,
  59. page: 2,
  60. keyword: '',
  61. toSearch: false,
  62. haveKeyword: false,
  63. }
  64. },
  65. components: {
  66. "app-tab-nav": appTabNav,
  67. },
  68. computed: {
  69. ...mapState({
  70. mall: state => state.mallConfig.mall,
  71. })
  72. },
  73. methods: {
  74. open(e) {
  75. this.id = e;
  76. },
  77. goSearch() {
  78. uni.showLoading({
  79. mask: true,
  80. title: '加载中...'
  81. });
  82. this.getList();
  83. },
  84. tabStatus(e) {
  85. uni.showLoading({
  86. mask: true,
  87. title: '加载中...'
  88. });
  89. this.list = [];
  90. this.page = 2;
  91. this.activeTab = e.currentTarget.dataset.id;
  92. this.getList();
  93. },
  94. getSetting() {
  95. let that = this;
  96. that.$request({
  97. url: that.$api.bonus.setting,
  98. }).then(response=>{
  99. if(response.code == 0) {
  100. that.setting = response.data.list;
  101. if (that.setting.form && that.setting.form.orders) {
  102. uni.setNavigationBarTitle({
  103. title: that.setting.form.orders,
  104. })
  105. } else {
  106. uni.setNavigationBarTitle({
  107. title: '分红订单',
  108. })
  109. }
  110. }else {
  111. uni.showToast({
  112. title: response.msg,
  113. icon: 'none',
  114. duration: 1000
  115. });
  116. }
  117. }).catch(response => {
  118. that.$event.on(that.$const.EVENT_USER_LOGIN).then(()=>{
  119. that.getSetting();
  120. });
  121. });
  122. },
  123. getList() {
  124. let that = this;
  125. that.$request({
  126. url: that.$api.bonus.order,
  127. data: {
  128. status: that.activeTab,
  129. keyword: that.keyword
  130. },
  131. }).then(response=>{
  132. that.$hideLoading();
  133. uni.hideLoading();
  134. if(response.code == 0) {
  135. that.list = response.data.list;
  136. }else {
  137. uni.showToast({
  138. title: response.msg,
  139. icon: 'none',
  140. duration: 1000
  141. });
  142. }
  143. }).catch(response => {
  144. that.$hideLoading();
  145. uni.hideLoading();
  146. that.$event.on(that.$const.EVENT_USER_LOGIN).then(()=>{
  147. that.getList();
  148. });
  149. });
  150. },
  151. getMore() {
  152. let that = this;
  153. let url;
  154. uni.showLoading({
  155. mask: true,
  156. title: '加载中...'
  157. });
  158. that.$request({
  159. url: that.$api.bonus.order,
  160. data: {
  161. status: that.activeTab,
  162. keyword: that.keyword,
  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. cancelSeacrch() {
  185. this.keyword = '';
  186. this.toSearch = !this.toSearch;
  187. this.getList();
  188. this.$hideLoading();
  189. },
  190. },
  191. onLoad(options) { this.$commonLoad.onload(options);
  192. let that = this;
  193. if (options.nickname) {
  194. that.keyword = options.nickname;
  195. that.haveKeyword = true;
  196. that.toSearch = true;
  197. }
  198. that.$showLoading({
  199. text: '加载中...'
  200. });
  201. that.getSetting();
  202. that.getList();
  203. },
  204. onReachBottom() {
  205. this.getMore();
  206. }
  207. }
  208. </script>
  209. <style scoped lang="scss">
  210. .no-tip {
  211. position: fixed;
  212. top: #{400rpx};
  213. left: 0;
  214. right: 0;
  215. margin: 0 auto;
  216. color: #666666;
  217. font-size: #{24rpx};
  218. width: #{240rpx};
  219. text-align: center;
  220. image {
  221. height: #{240rpx};
  222. width: #{240rpx};
  223. margin-bottom: #{20rpx};
  224. }
  225. }
  226. .search {
  227. height: #{88rpx};
  228. padding: #{16rpx} #{26rpx};
  229. background-color: #efeff4;
  230. position: fixed;
  231. top: 0;
  232. left: 0;
  233. right: 0;
  234. z-index: 10;
  235. }
  236. .search input {
  237. padding: 0 #{30rpx};
  238. }
  239. .search-content {
  240. background-color: #fff;
  241. height: #{56rpx};
  242. border-radius: #{28rpx};
  243. }
  244. .search-content image {
  245. height:#{24rpx};
  246. width:#{24rpx};
  247. }
  248. .search-content text {
  249. color:#b2b2b2;
  250. font-size:#{24rpx};
  251. margin:0 #{5rpx};
  252. }
  253. .search-area {
  254. height: #{56rpx};
  255. }
  256. .placeholder {
  257. height: #{88rpx};
  258. }
  259. .order-item {
  260. margin: #{16rpx} #{24rpx} 0;
  261. border-radius: #{16rpx};
  262. background-color: #fff;
  263. padding: #{28rpx} #{24rpx};
  264. font-size: #{28rpx};
  265. color: #353535;
  266. }
  267. .order-no {
  268. margin-bottom: #{28rpx};
  269. }
  270. .order-nickname {
  271. width: #{240rpx};
  272. }
  273. .goods-item {
  274. height: #{80rpx};
  275. line-height: #{80rpx};
  276. width: #{330rpx};
  277. }
  278. .goods-img {
  279. height: #{80rpx};
  280. width: #{80rpx};
  281. border-radius: #{10rpx};
  282. margin-right: #{24rpx};
  283. }
  284. .bonus-info {
  285. font-size: #{24rpx};
  286. color: #999;
  287. }
  288. .search-input {
  289. height: #{56rpx};
  290. position: relative;
  291. width: #{620rpx};
  292. }
  293. .search-input image {
  294. height: #{22rpx};
  295. width: #{22rpx};
  296. position: absolute;
  297. top: #{17rpx};
  298. left: #{28rpx};
  299. z-index: 10;
  300. }
  301. .search-input input {
  302. padding-left: #{66rpx};
  303. background-color: #fff;
  304. border-radius: #{32rpx};
  305. height: #{56rpx};
  306. font-size: #{26rpx};
  307. color: #353535;
  308. }
  309. .cancel {
  310. margin-left: #{16rpx};
  311. font-size: #{28rpx};
  312. color: #00c203;
  313. }
  314. .goods-price {
  315. margin-bottom: #{4rpx};
  316. }
  317. .goods-price text {
  318. font-size:#{24rpx};
  319. color:#353535;
  320. }
  321. .bonus-price text {
  322. font-size:#{28rpx};
  323. color:#ff4544;
  324. }
  325. </style>