submitStockCheck.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. <template>
  2. <view class="content flex flex_column">
  3. <view class="head-info" v-if="detail">
  4. <view>
  5. <text>货架名称</text>
  6. <view>{{detail.shelfName}}</view>
  7. </view>
  8. <view>
  9. <text>盘点日期</text>
  10. <view>{{detail.checkDate}}</view>
  11. </view>
  12. <view>
  13. <text>盘点人</text>
  14. <view>{{detail.checkPersonName}}</view>
  15. </view>
  16. <view>
  17. <text>备注</text>
  18. <view>
  19. <u-input v-if="type=='submit'" v-model="remarks" placeholder="请输入备注" input-align="right" type="textarea" :height="60" :auto-height="true" />
  20. <text v-else>{{detail.remarks}}</text>
  21. </view>
  22. </view>
  23. </view>
  24. <view class="detail flex_1">
  25. <view class="detail-tongji" v-if="detail">
  26. <view>盘盈总数量:<text>{{detail.totalProfitQty}}</text>;盘盈总金额:<text>{{detail.totalProfitCost}}</text>;</view>
  27. <view>盘亏总数量:<text>{{detail.totalLossQty}}</text>;盘亏总金额:<text>{{detail.totalLossCost}}</text>;</view>
  28. <view>盈亏总数量:<text>{{detail.totalProfitLossQty}}</text>;盈亏总金额:<text>{{detail.totalProfitLossCost}}</text>;</view>
  29. </view>
  30. <view class="cpb_cart-list">
  31. <view class="nav-right-item flex" v-for="(item, index) in chooseList" :key="item.id" >
  32. <view class="uni-col-2">
  33. <u-image :src="item.product&&item.product.images?item.product.images:`../../static/${$config('themePath')}/def_img@2x.png`" width="100" height="100" border-radius="30"></u-image>
  34. </view>
  35. <view class="item-info uni-col-10">
  36. <view class="item-name">
  37. <text>{{item.shelfPlaceCode}}</text>
  38. {{item.productCode}}
  39. </view>
  40. <view class="item-detail">
  41. <view class="item-detail-info">
  42. <view class="flex justify_between">
  43. <view>
  44. <text class="item-detail-text">
  45. 可用:
  46. </text>
  47. {{item.stockQty||0}}
  48. </view>
  49. <view>
  50. <text class="item-detail-text">
  51. 冻结:
  52. </text>
  53. {{item.freezeQty||0}}
  54. </view>
  55. <view>
  56. <text class="item-detail-text">
  57. 实际可用:
  58. </text>
  59. <text class="red">
  60. {{item.checkQty||0}}
  61. </text>
  62. </view>
  63. </view>
  64. <view class="flex justify_between">
  65. <view>
  66. <text class="item-detail-text">
  67. 结算价:
  68. </text>
  69. ¥{{item.cost||0}}
  70. </view>
  71. <view>
  72. <text class="item-detail-text">
  73. 盈亏:
  74. </text>
  75. {{item.checkProfitLossQty||0}}
  76. (¥{{item.checkProfitLossCost||0}})
  77. </view>
  78. </view>
  79. </view>
  80. </view>
  81. </view>
  82. </view>
  83. </view>
  84. </view>
  85. <!-- 底部栏 -->
  86. <view class="footer-bar flex justify_between align_center" v-if="type=='submit'">
  87. <u-button size="medium" @click="goback" shape="circle" type="default" hover-class="none" >继续盘点</u-button>
  88. <u-button size="medium" @click="submitOrder" :custom-style="customBtnStyle" shape="circle" type="primary" hover-class="none" >盘点完成</u-button>
  89. </view>
  90. <!-- 确认弹框 -->
  91. <common-modal v-if="confirmModal" :openModal="confirmModal" :content="errorMsg" confirmText="知道了" @confirm="confirmModal=false" @close="confirmModal=false" />
  92. </view>
  93. </template>
  94. <script>
  95. import {
  96. stockCheckDetailQueryList,
  97. stockCheckBySn,
  98. stockCheckConfirm
  99. } from '@/api/stockCheck'
  100. import commonModal from '@/pages/common/commonModal'
  101. import { clzConfirm } from '@/libs/tools'
  102. export default {
  103. components: {
  104. commonModal
  105. },
  106. data() {
  107. return {
  108. customBtnStyle: { // 自定义按钮样式
  109. borderColor: this.$config('primaryColor'),
  110. backgroundColor: this.$config('primaryColor'),
  111. color: '#fff'
  112. },
  113. stockCheckSn: null,
  114. remarks: '',
  115. detail: null,
  116. chooseList: [],
  117. type: '',
  118. errorMsg: '',
  119. confirmModal: false
  120. }
  121. },
  122. onLoad(opts) {
  123. this.stockCheckSn = opts.stockCheckSn
  124. this.type = opts.type
  125. this.getDetail()
  126. this.getChooseList()
  127. if(this.type == 'view'){
  128. uni.setNavigationBarTitle({
  129. title: '盘点单详情'
  130. })
  131. }
  132. },
  133. methods: {
  134. // 详细
  135. getDetail(){
  136. stockCheckBySn({stockCheckSn: this.stockCheckSn}).then(res => {
  137. this.detail = res.data || null
  138. })
  139. },
  140. // 获取盘点明细列表
  141. getChooseList(){
  142. stockCheckDetailQueryList({
  143. stockCheckSn: this.stockCheckSn
  144. }).then(res => {
  145. this.chooseList = res.data || []
  146. })
  147. },
  148. // 盘点完成
  149. submitOrder(){
  150. const _this = this
  151. clzConfirm({
  152. title: '提示',
  153. content: '盘点完成后,无法再修改数据,确认盘点完成吗?',
  154. success (ret) {
  155. if (ret.confirm || ret.index == 0) {
  156. uni.showLoading({
  157. title:"正在提交.."
  158. })
  159. stockCheckConfirm({
  160. remarks: _this.remarks,
  161. stockCheckSn: _this.stockCheckSn
  162. }).then(res => {
  163. console.log(res)
  164. if(res.status == 200 && res.data){
  165. _this.goback()
  166. uni.$emit("resetStockCheck")
  167. uni.showToast({
  168. icon:'none',
  169. title: res.message
  170. })
  171. }else{
  172. if(res.errCode == 'VALIDATE_STOCK_LACK'){
  173. this.errorMsg = res.message
  174. this.confirmModal = true
  175. }
  176. }
  177. uni.hideLoading()
  178. })
  179. }
  180. }
  181. })
  182. },
  183. goback(){
  184. uni.navigateBack()
  185. }
  186. }
  187. }
  188. </script>
  189. <style lang="less">
  190. .content{
  191. width:100%;
  192. height: 100vh;
  193. background-color: #fff;
  194. .head-info{
  195. padding: 0 30upx;
  196. > view{
  197. display: flex;
  198. justify-content: space-between;
  199. padding: 15upx 10upx;
  200. color:#666;
  201. > text{
  202. color: #999;
  203. width: 150rpx;
  204. }
  205. border-bottom:2rpx solid #f8f8f8;
  206. > view{
  207. width: 80%;
  208. text-align: right;
  209. word-break: break-all;
  210. }
  211. }
  212. }
  213. .detail{
  214. flex-grow: 1;
  215. overflow: auto;
  216. .detail-tongji{
  217. padding: 15upx 30upx;
  218. > view{
  219. padding: 10upx;
  220. color:#999;
  221. text{
  222. color: #666;
  223. }
  224. }
  225. border-top:10rpx solid #f8f8f8;
  226. border-bottom:10rpx solid #f8f8f8;
  227. }
  228. }
  229. .cpb_cart-list{
  230. padding: 10upx 30upx;
  231. > view{
  232. border-bottom:2rpx solid #f8f8f8;
  233. padding: 15upx 0;
  234. }
  235. .item-name{
  236. font-size: 30rpx;
  237. text{
  238. background: #eef6ff;
  239. color: #174b76;
  240. border-radius: 1em;
  241. font-size: 0.8em;
  242. padding: 0 0.5em;
  243. margin-right: 10upx;
  244. }
  245. margin-bottom: 10upx;
  246. }
  247. .item-info{
  248. flex-grow: 1;
  249. padding-left: 0.2em;
  250. }
  251. .item-detail{
  252. .item-detail-info{
  253. padding: 10upx 0 4upx;
  254. font-size: 24upx;
  255. > view{
  256. padding-bottom: 10rpx;
  257. align-items: center;
  258. .item-detail-text{
  259. color: #999;
  260. }
  261. .red{
  262. color: red;
  263. }
  264. }
  265. }
  266. }
  267. }
  268. .footer-bar{
  269. background-color: #f8f8f8;
  270. padding: 20upx;
  271. button{
  272. width: 300upx;
  273. }
  274. }
  275. }
  276. </style>