order.vue 9.7 KB

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