detaiList.vue 8.3 KB

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