detaiList.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  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><text v-if="$hasPermissions('M_showCostPrice_mobile')">¥{{toThousands(item.putCost||0, 2)}} * {{toThousands(item.currentQty||0)}}</text><text v-else>{{toThousands(item.currentQty||0)}}</text>{{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({ allowDefault: true }).globalData.theme
  114. this.stockInfo = this.$store.state.vuex_tempData
  115. this.getList()
  116. },
  117. onUnload() {
  118. this.$store.state.vuex_tempData = null
  119. },
  120. methods: {
  121. // 列表
  122. getList(pageNo){
  123. const _this = this
  124. if (pageNo) {
  125. this.pageNo = pageNo
  126. }
  127. let params = {}
  128. let url = stockDetailList
  129. if(this.curNow == 0){ // 库存详情
  130. url = stockDetailList
  131. params = {
  132. pageNo: this.pageNo,
  133. pageSize: this.pageSize,
  134. stockSn: this.stockInfo && this.stockInfo.stockSn || '',
  135. isSellOut: '0'
  136. }
  137. }else if(this.curNow == 1){ // 出入库明细
  138. url = stockFlowList
  139. params = {
  140. pageNo: this.pageNo,
  141. pageSize: this.pageSize,
  142. productSn: this.stockInfo && this.stockInfo.productSn || ''
  143. }
  144. }
  145. url(params).then(res => {
  146. if (res.status == 200) {
  147. if(res.data && res.data.list){
  148. if(this.curNow == 1){ // 出入库明细
  149. res.data.list.map(item => {
  150. if(item.flowType == 'PUT'){
  151. item.qty = item.putQty || 0
  152. }else if(item.flowType == 'OUT'){
  153. item.qty = item.outQty || 0
  154. }
  155. })
  156. }
  157. if(this.pageNo>1){
  158. this.listData = this.listData.concat(res.data && res.data.list || [])
  159. }else{
  160. this.listData = res.data.list || []
  161. }
  162. }else{
  163. this.listData = []
  164. }
  165. this.totalNum = res.data && res.data.count || 0
  166. } else {
  167. this.listData = []
  168. this.totalNum = 0
  169. this.noDataText = res.message
  170. }
  171. })
  172. },
  173. // scroll-view到底部加载更多
  174. onreachBottom() {
  175. if(this.listData.length < this.totalNum){
  176. this.pageNo += 1
  177. this.getList()
  178. }
  179. },
  180. // 详情
  181. getDetail(data){
  182. if(this.curNow == 0){ // 库存详情
  183. uni.navigateTo({ url: "/pages/stock/stockDetail?productData="+JSON.stringify(this.stockInfo)+"&data="+JSON.stringify(data) })
  184. }else if(this.curNow == 1){ // 出入库明细
  185. uni.navigateTo({ url: "/pages/stock/warehouseDetail?productData="+JSON.stringify(this.stockInfo)+"&data="+JSON.stringify(data) })
  186. }
  187. },
  188. sectionChange(index) {
  189. this.curNow = index
  190. this.getList(1)
  191. }
  192. }
  193. }
  194. </script>
  195. <style lang="less">
  196. .st-detailList-wrap{
  197. width: 100%;
  198. height: 100vh;
  199. .panel-box {
  200. background-color: #ffffff;
  201. box-shadow: 3upx 2upx 6upx #eee;
  202. margin-bottom: 20upx;
  203. .type-box{
  204. margin: 0 auto 20upx;
  205. width: 65%;
  206. }
  207. .st-detailList-info{
  208. background: #ffffff;
  209. padding: 20upx;
  210. margin-bottom: 25upx;
  211. border-radius: 25upx;
  212. box-shadow: 1px 1px 3px #EEEEEE;
  213. .st-detailList-tit{
  214. padding-bottom: 20upx;
  215. border-bottom: 1px solid #e4e7ed;
  216. font-weight: bold;
  217. .u-line{
  218. display: inline-block;
  219. width: 6upx;
  220. height: 40upx;
  221. background-color: red;
  222. vertical-align: bottom;
  223. margin: 0 20upx 0 10upx;
  224. }
  225. }
  226. .st-detailList-info-con{
  227. padding: 20upx 20upx 6upx;
  228. font-size: 26upx;
  229. .pimgs{
  230. margin-right: 16upx;
  231. }
  232. .font_13{
  233. font-size: 26upx;
  234. }
  235. .padding_3{
  236. padding: 6upx 0;
  237. }
  238. }
  239. }
  240. }
  241. .st-detailList-con{
  242. height: calc(100vh - 370upx);
  243. .st-detailList-main{
  244. .st-detailList-main-item{
  245. background-color: #fff;
  246. margin: 0 20upx 10upx;
  247. border-radius: 15upx;
  248. box-shadow: 1px 1px 3px #EEEEEE;
  249. padding: 20upx 20upx;
  250. .margin-b20{
  251. margin-bottom: 20upx;
  252. }
  253. > view{
  254. &:first-child{
  255. flex-grow: 1;
  256. }
  257. &:last-child{
  258. padding: 0 0 0 20upx;
  259. }
  260. }
  261. }
  262. }
  263. }
  264. }
  265. </style>