detaiList.vue 8.0 KB

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