detaiList.vue 8.5 KB

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