detaiList.vue 8.0 KB

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