detaiList.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. <template>
  2. <view class="st-detailList-wrap">
  3. <view class="panel-box">
  4. <view class="type-box">
  5. <u-subsection @change="sectionChange" mode="subsection" height="60" :list="list" :current="curNow" :active-color="$config('primaryColor')"></u-subsection>
  6. </view>
  7. <view class="st-detailList-info">
  8. <view class="st-detailList-tit">
  9. <view class="u-line" :style="{backgroundColor: $config('primaryColor')}"></view>{{stockInfo&&stockInfo.productName ? stockInfo.productName : '--'}}
  10. </view>
  11. <view class="st-detailList-info-con flex align_center">
  12. <view class="pimgs">
  13. <u-image :src="stockInfo&&stockInfo.product&&stockInfo&&stockInfo.product.productMsg?stockInfo&&stockInfo.product.productMsg:`../../static/${theme}/def_img@2x.png`" width="128" height="128" border-radius="10"></u-image>
  14. </view>
  15. <view class="flex_1">
  16. <view>产品编码:{{stockInfo&&stockInfo.productCode ? stockInfo.productCode : '--'}}</view>
  17. <view class="padding_3">原厂编码:{{stockInfo&&stockInfo.productOrigCode ? stockInfo.productOrigCode : '--'}}</view>
  18. <view class="flex align_center justify_between">
  19. <view class="font_13">
  20. 可用数量:
  21. <u-count-to :end-val="stockInfo&&stockInfo.currentStockQty ? stockInfo&&stockInfo.currentStockQty : 0" separator="," font-size="26"></u-count-to>个
  22. </view>
  23. <view class="font_13">
  24. 库存成本:
  25. ¥<u-count-to :end-val="stockInfo&&stockInfo.currentStockCost ? stockInfo&&stockInfo.currentStockCost : 0" separator="," font-size="26" :decimals="2"></u-count-to>
  26. </view>
  27. </view>
  28. </view>
  29. </view>
  30. </view>
  31. </view>
  32. <!-- 查询结果 -->
  33. <scroll-view class="st-detailList-con" scroll-y @scrolltolower="onreachBottom">
  34. <view class="st-detailList-main">
  35. <!-- 库存详情 -->
  36. <view v-if="curNow==0" class="st-detailList-main-item" v-for="(item, index) in listData" :key="item.id" @click="getDetail(item)">
  37. <view class="flex align_center justify_between margin-b20">
  38. <view :style="{color: $config('infoColor')}">{{item.putTime || '--'}}</view>
  39. <u-tag :text="item.putBizTypeDictValue" :border-color="$config('primaryColor')" shape="circle" size="mini" />
  40. </view>
  41. <view class="flex align_center justify_between">
  42. <view v-if="item.warehouseName || item.warehouseLocationName">{{item.warehouseName}} > {{item.warehouseLocationName}}</view>
  43. <view v-else>--</view>
  44. <view>¥{{item.putCost}} * {{item.currentQty}}{{item.productUnit}}</view>
  45. </view>
  46. </view>
  47. <!-- 出入库明细 -->
  48. <view v-if="curNow==1" class="st-detailList-main-item" v-for="(item, index) in listData" :key="item.id" @click="getDetail(item)">
  49. <view class="flex align_center justify_between margin-b20">
  50. <view :style="{color: $config('infoColor')}">{{item.auditTime || '--'}}</view>
  51. <u-tag :text="item.bizTypeDictValue" :border-color="$config('primaryColor')" shape="circle" size="mini" />
  52. </view>
  53. <view class="flex align_center justify_between">
  54. <view>{{item.unitName || '--'}}</view>
  55. <view :style="{color: item.flowType=='PUT' ? 'green':'red'}"><text v-if="item.qty!=0">{{ item.flowType=='PUT' ? '+':'-' }}</text>{{ item.qty }}{{item.productUnit}}</view>
  56. </view>
  57. </view>
  58. <view v-if="listData && listData.length == 0">
  59. <u-empty :text="noDataText" mode="list" :img-width="200" :margin-top="30"></u-empty>
  60. </view>
  61. </view>
  62. </scroll-view>
  63. </view>
  64. </template>
  65. <script>
  66. import { stockDetailList, stockFlowList } from '@/api/stock'
  67. export default{
  68. data(){
  69. return {
  70. list: [
  71. { name: '库存详情' },
  72. { name: '出入库明细' }
  73. ],
  74. totalData: null,
  75. totalNum: 0,
  76. listData: [],
  77. pageNo: 1,
  78. pageSize: 10,
  79. stockInfo: null,
  80. noDataText: '暂无数据',
  81. curNow: 0,
  82. theme: ''
  83. }
  84. },
  85. onLoad(option) {
  86. this.theme = getApp().globalData.theme
  87. this.stockInfo = option.data ? JSON.parse(option.data) : null
  88. this.getList()
  89. },
  90. methods: {
  91. // 列表
  92. getList(pageNo){
  93. const _this = this
  94. if (pageNo) {
  95. this.pageNo = pageNo
  96. }
  97. let url = stockDetailList
  98. if(this.curNow == 0){ // 库存详情
  99. url = stockDetailList
  100. }else if(this.curNow == 1){ // 出入库明细
  101. url = stockFlowList
  102. }
  103. url({ pageNo: this.pageNo, pageSize: this.pageSize }).then(res => {
  104. if (res.status == 200) {
  105. if(this.pageNo>1){
  106. this.listData = this.listData.concat(res.data.list || [])
  107. }else{
  108. this.listData = res.data.list || []
  109. }
  110. this.totalNum = res.data.count || 0
  111. } else {
  112. this.listData = []
  113. this.totalNum = 0
  114. this.noDataText = res.message
  115. }
  116. })
  117. },
  118. // scroll-view到底部加载更多
  119. onreachBottom() {
  120. if(this.listData.length < this.totalNum){
  121. this.pageNo += 1
  122. this.getList()
  123. }
  124. },
  125. // 详情
  126. getDetail(data){
  127. if(this.curNow == 0){ // 库存详情
  128. uni.navigateTo({ url: "/pages/stock/stockDetail?productData="+JSON.stringify(this.stockInfo)+"&data="+JSON.stringify(data) })
  129. }else if(this.curNow == 1){ // 出入库明细
  130. uni.navigateTo({ url: "/pages/stock/warehouseDetail?productData="+JSON.stringify(this.stockInfo)+"&data="+JSON.stringify(data) })
  131. }
  132. },
  133. sectionChange(index) {
  134. this.curNow = index
  135. this.getList(1)
  136. }
  137. }
  138. }
  139. </script>
  140. <style lang="scss">
  141. .st-detailList-wrap{
  142. width: 100%;
  143. height: 100vh;
  144. .panel-box {
  145. background-color: #ffffff;
  146. box-shadow: 3upx 2upx 6upx #eee;
  147. margin-bottom: 20upx;
  148. .type-box{
  149. margin: 0 auto 20upx;
  150. width: 65%;
  151. }
  152. .st-detailList-info{
  153. background: #ffffff;
  154. padding: 20upx;
  155. margin-bottom: 25upx;
  156. border-radius: 25upx;
  157. box-shadow: 1px 1px 3px #EEEEEE;
  158. .st-detailList-tit{
  159. padding-bottom: 20upx;
  160. border-bottom: 1px solid #e4e7ed;
  161. white-space: nowrap;
  162. overflow: hidden;
  163. text-overflow: ellipsis;
  164. .u-line{
  165. display: inline-block;
  166. width: 6upx;
  167. height: 40upx;
  168. background-color: red;
  169. vertical-align: bottom;
  170. margin: 0 20upx 0 10upx;
  171. }
  172. }
  173. .st-detailList-info-con{
  174. padding: 20upx 20upx 6upx;
  175. font-size: 26upx;
  176. .pimgs{
  177. margin-right: 16upx;
  178. }
  179. .font_13{
  180. font-size: 26upx;
  181. }
  182. .padding_3{
  183. padding: 6upx 0;
  184. }
  185. }
  186. }
  187. }
  188. .st-detailList-con{
  189. height: calc(100vh - 356upx);
  190. .st-detailList-main{
  191. .st-detailList-main-item{
  192. background-color: #fff;
  193. margin: 0 20upx 10upx;
  194. border-radius: 25upx;
  195. box-shadow: 1px 1px 3px #EEEEEE;
  196. padding: 20upx 20upx;
  197. .margin-b20{
  198. margin-bottom: 20upx;
  199. }
  200. }
  201. }
  202. }
  203. }
  204. </style>