purchase.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. <template>
  2. <view class="home bg-f9">
  3. <header-bar addUrl="/purchase/add" title="申购列表"></header-bar>
  4. <uni-search-bar v-model="req.keyword" placeholder="输入关键词" @confirm="search" @cancel="cancel" bgColor="#fff"
  5. cancel-text="取消">
  6. </uni-search-bar>
  7. <view class="common-list-box" v-for="(i,index) in dataList" :key="i.index" @click="toDtl(i)">
  8. <view class="text">
  9. <view class="text-list" v-for="(j,jndex) in config" :key="jndex">
  10. <span class="label">
  11. {{j.label}}
  12. </span>
  13. <span class="value">
  14. {{i[j.key]}}
  15. </span>
  16. </view>
  17. </view>
  18. <view class="more success">
  19. <view class="common-stat-box">
  20. 已采购
  21. </view>
  22. <uni-icons type="forward" class="icon" size="30"></uni-icons>
  23. </view>
  24. </view>
  25. <!-- <common-list :config="config" @listClick="toDtl" :data="dataList"></common-list> -->
  26. <button type="default" @click="getList()" style="margin-top:10rpx">
  27. {{status == 'more' ? '点击加载更多' : status == 'noMore' ? '已经到底了' : '加载中..'}}
  28. </button>
  29. </view>
  30. </template>
  31. <script>
  32. import headerBar from '../../../components/header-bar/index.vue'
  33. import commonList from '../../../components/common-list/common-list.vue'
  34. import {formateObjToParamStr} from '../../../util/uitl.js'
  35. import Vue from 'vue'
  36. export default {
  37. components: {
  38. headerBar,
  39. commonList
  40. },
  41. data() {
  42. return {
  43. status: 'more',
  44. config: [{
  45. label: "申购单号",
  46. key: 'typeName',
  47. },
  48. {
  49. label: "申购人",
  50. key: 'name',
  51. },
  52. {
  53. label: "申购时间",
  54. key: 'unit',
  55. }
  56. ],
  57. dataList: [],
  58. req: {
  59. pageNum: 1,
  60. pageSize: 10,
  61. keyword: null,
  62. },
  63. }
  64. },
  65. onLoad() {
  66. this.search()
  67. },
  68. onShow() {
  69. if(this.needRefresh) this.search();
  70. },
  71. methods: {
  72. toDtl(i){
  73. console.log(i)
  74. uni.navigateTo({
  75. url: '/pages/supplyChain/purchase/add?' + formateObjToParamStr(i)
  76. })
  77. },
  78. cancel() {
  79. this.req.keyword = null
  80. },
  81. search() {
  82. this.req.pageNum = 1
  83. this.status = 'more'
  84. this.dataList = []
  85. this.getList()
  86. },
  87. getList() {
  88. const v = this
  89. if (v.status === 'more') {
  90. v.status = 'loading'
  91. } else {
  92. return
  93. }
  94. v.$post('/api/syringe-production/factoryProduct/list',{}).then(res => {
  95. console.log(res)
  96. })
  97. v.$post('/api/basics/product/page', v.req).then(res => {
  98. res.data.records.map(items => {
  99. items.typeName = (items.type === 0) ? '半成品' : '成品'
  100. })
  101. v.dataList = [...v.dataList, ...res.data.records]
  102. if (res.data.pages === v.req.pageNum || res.data.pages === 0) {
  103. v.status = 'noMore'
  104. } else {
  105. v.status = 'more'
  106. v.req.pageNum++
  107. }
  108. })
  109. },
  110. },
  111. }
  112. </script>
  113. <style lang="less">
  114. /deep/.bg-f9{
  115. background-color: #f9f9f9;
  116. min-height: 100vh;
  117. }
  118. /deep/.uni-forms-item{
  119. background-color: #fff;
  120. margin-bottom: 6rpx!important;
  121. padding: 6rpx 24rpx 26rpx!important;
  122. }
  123. /deep/.is-input-border{
  124. border:none!important;
  125. }
  126. .common-list-box{
  127. background-color: #fff;
  128. padding: 24rpx;
  129. margin-top: 6rpx;
  130. display: flex;
  131. justify-content: space-between;
  132. .text{
  133. .text-list{
  134. line-height: 60rpx;
  135. .label{
  136. color: #999999;
  137. }
  138. .value{
  139. color: #000;
  140. margin-left: 20rpx;
  141. }
  142. }
  143. }
  144. .common-stat-box{
  145. border:6rpx solid red;
  146. height: 80rpx;
  147. width: 80rpx;
  148. text-align: center;
  149. line-height: 80rpx;
  150. border-radius: 50%;
  151. position: relative;
  152. font-size: 20rpx;
  153. transform:rotate(-25deg);
  154. }
  155. .common-stat-box::before{
  156. display: block;
  157. position: absolute;
  158. width: 68rpx;
  159. height: 68rpx;
  160. left: 6rpx;
  161. top: 6rpx;
  162. border:2rpx solid red;
  163. border-radius: 50%;
  164. content: ' ';
  165. }
  166. .more{
  167. display: flex;
  168. align-items: center;
  169. }
  170. .success{
  171. .common-stat-box{
  172. border-color: #39C55A;
  173. color: #39C55A;
  174. }
  175. .common-stat-box::before{
  176. border-color: #39C55A;
  177. }
  178. }
  179. .error{
  180. .common-stat-box{
  181. border-color: #F94539;
  182. color: #F94539;
  183. }
  184. .common-stat-box::before{
  185. border-color: #F94539;
  186. }
  187. }
  188. .warning{
  189. .common-stat-box{
  190. border-color: #FF9315;
  191. color: #FF9315;
  192. }
  193. .common-stat-box::before{
  194. border-color: #FF9315;
  195. }
  196. }
  197. }
  198. </style>