index.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. <template>
  2. <view v-if="$accessCheck($Access.PurchaseOrderGetAllPurchase)">
  3. <view class="keyword-view clearfix">
  4. <view class="float_left">
  5. <u-search @clear="searchData()" @search="searchData()" :show-action="false" :clearabled="true" placeholder="采购单号" v-model="search_form.no"></u-search>
  6. </view>
  7. <view class="float_right" @click="openSearch"><text class="custom-icon custom-icon-shaixuan"></text></view>
  8. </view>
  9. <view class="list-ul">
  10. <block v-for="(item, index) in purchase_list" :key="index">
  11. <view v-if="$accessCheck($Access.PurchaseOrderGetPurchaseInfoById)" class="list-li" @click="goPage(`/pagesT/Purchase/PurchaseDetail?id=${item.id}`)">
  12. <view class="top clearfix">
  13. <view class="ellipsis float_left">{{ item.supplierName }}</view>
  14. <view class="float_right">
  15. <text v-if="item.auditStatus === 2" class="success-status">已审核</text>
  16. <text v-else class="warning-status">待审核</text>
  17. <u-icon name="arrow-right" size="28" color="#999999"></u-icon>
  18. </view>
  19. </view>
  20. <view class="list-cont">
  21. <view class="total-money">{{ $utils.formattedNumber(item.purchaseAmount) }}</view>
  22. <view class="info-li" style="font-size: 28rpx; color: #111111;">{{ item.warehouseName }}</view>
  23. <view class="info-li" @click.stop="copy(item.no)">
  24. <text style="margin-right: 20rpx;">{{ item.no }}</text>
  25. <u-icon name="copy" custom-prefix="custom-icon" size="22"></u-icon>
  26. </view>
  27. <view class="info-li clearfix">
  28. <text class="float_left">{{ $u.timeFormat(item.createTime, 'yyyy-mm-dd hh:MM:ss') }}</text>
  29. <text class="float_right">采购员:{{ item.buyerName }}</text>
  30. </view>
  31. </view>
  32. </view>
  33. </block>
  34. </view>
  35. <u-loadmore v-if="purchase_list.length" :status="load_status" />
  36. <view v-else class="empty-view"><u-empty text="暂无数据" mode="list"></u-empty></view>
  37. <addBtn v-if="$accessCheck($Access.PurchaseOrderAddPurchase)" url="/pagesT/Purchase/AddPurchase"></addBtn>
  38. <u-popup v-model="search_show" mode="right">
  39. <view class="search-pop">
  40. <view class="form-view">
  41. <u-form label-width="160rpx" label-position="left">
  42. <u-form-item label="仓库">
  43. <view class="clearfix form-val" @click="goPage('/pagesT/werahouse/selWerahouse')">
  44. <text class="float_left ellipsis">{{ search_form.warehouseId ? warehouse_name : '请选择' }}</text>
  45. <view class="float_right" @click.stop="clearValue('warehouseId')">
  46. <u-icon :name="!search_form.warehouseId ? 'arrow-right' : 'close-circle-fill'" size="28" color="#999999"></u-icon>
  47. </view>
  48. </view>
  49. </u-form-item>
  50. <u-form-item label-position="top" label="审核状态">
  51. <text
  52. v-for="(item, index) in order_status"
  53. :key="index"
  54. class="check-li"
  55. :class="[search_form.auditStatus === item.value ? 'active' : '']"
  56. @click="statusChange(item)"
  57. >
  58. {{ item.label }}
  59. </text>
  60. </u-form-item>
  61. </u-form>
  62. </view>
  63. <view class="search-btn">
  64. <view class="btn-li" @click="clearValue()">重置</view>
  65. <view class="btn-li" @click="searchData">确定</view>
  66. </view>
  67. </view>
  68. </u-popup>
  69. </view>
  70. </template>
  71. <script>
  72. export default {
  73. data() {
  74. return {
  75. order_status: [{ value: 2, label: '已审核' }, { value: 1, label: '待审核' }],
  76. search_show: false,
  77. warehouse_name: '',
  78. page: 1,
  79. pageSize: 10,
  80. total: 0,
  81. load_status: 'nomore',
  82. purchase_list: [],
  83. werahouseData:'',
  84. search_form: {
  85. no: '',
  86. auditStatus: '',
  87. warehouseId: ''
  88. }
  89. };
  90. },
  91. watch: {
  92. werahouseData(val) {
  93. if (val) {
  94. this.search_form.warehouseId = val.id;
  95. this.warehouse_name = val.warehouseName;
  96. }
  97. }
  98. },
  99. onShow() {
  100. this.searchData();
  101. },
  102. onReachBottom() {
  103. if (this.total / this.pageSize > this.page) {
  104. this.page += 1;
  105. this.getAllPurchase();
  106. }
  107. },
  108. onPullDownRefresh() {
  109. this.searchData();
  110. },
  111. methods: {
  112. clearValue(key) {
  113. if (!key) {
  114. this.search_form = {
  115. no: '',
  116. auditStatus: '',
  117. warehouseId: ''
  118. };
  119. this.searchData();
  120. } else {
  121. this.search_form[key] = '';
  122. }
  123. },
  124. openSearch() {
  125. this.search_show = true;
  126. },
  127. statusChange(row) {
  128. this.search_form.auditStatus = row.value;
  129. },
  130. getAllPurchase() {
  131. this.load_status = 'loading';
  132. this.$u.api
  133. .getAllPurchase({
  134. auditStatus: this.search_form.auditStatus,
  135. no: this.search_form.no,
  136. page: this.page,
  137. pageSize: this.pageSize,
  138. warehouseId: this.search_form.warehouseId
  139. })
  140. .then(res => {
  141. if (this.page === 1) {
  142. this.purchase_list = res.data;
  143. } else {
  144. this.purchase_list = this.purchase_list.concat(res.data);
  145. }
  146. this.total = res.pageTotal;
  147. this.load_status = this.$utils.loadStatus(this.page, this.pageSize, this.total);
  148. });
  149. },
  150. searchData() {
  151. this.page = 1;
  152. this.search_show = false;
  153. this.getAllPurchase();
  154. }
  155. }
  156. };
  157. </script>
  158. <style lang="scss" scoped>
  159. .keyword-view {
  160. position: fixed;
  161. width: 100%;
  162. top: 0;
  163. left: 0;
  164. padding: 20rpx 24rpx;
  165. background-color: #ffffff;
  166. z-index: 9;
  167. .float_left {
  168. width: 640rpx;
  169. }
  170. .float_right {
  171. line-height: 64rpx;
  172. width: 50rpx;
  173. text-align: center;
  174. color: #666666;
  175. }
  176. }
  177. .list-ul {
  178. padding-top: 100rpx;
  179. .list-li {
  180. width: 710rpx;
  181. background-color: #ffffff;
  182. margin: 20rpx auto;
  183. border-radius: 20rpx;
  184. padding: 30rpx 24rpx;
  185. .top {
  186. padding-bottom: 20rpx;
  187. border-bottom: 1px solid #eeeeee;
  188. .float_left {
  189. width: 400rpx;
  190. font-weight: bold;
  191. }
  192. }
  193. .list-cont {
  194. padding-top: 20rpx;
  195. position: relative;
  196. .total-money {
  197. position: absolute;
  198. top: 45%;
  199. right: 0;
  200. transform: translateY(-50%);
  201. color: $uni-color-error;
  202. font-weight: bold;
  203. }
  204. .info-li {
  205. color: #6c6c6c;
  206. font-size: 24rpx;
  207. padding-bottom: 10rpx;
  208. }
  209. }
  210. }
  211. }
  212. </style>