detaiList.vue 7.2 KB

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