detail.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  1. <template>
  2. <view class="replenishment-detail-wrap">
  3. <u-navbar back-text="补货单详情" :border-bottom="false" :background="{backgroundColor: $config('primaryColor')}" back-icon-color="#fff" :back-text-style="{ color: '#fff' }">
  4. <template v-slot:right>
  5. <view style="padding: 0 30upx;color: #ffffff;"
  6. @click="creatSalesOrder"
  7. v-if="pageType=='success'&&totalNums&&basicInfoData&&basicInfoData.shelfInfo.state!='WRITE_OFF'&&basicInfoData.shelfInfo.state!='SUSPEND'">
  8. <u-icon name="chuangjiandingdan" custom-prefix="iscm-icon"></u-icon>
  9. <text style="margin-left: 6rpx;">生成销售单</text>
  10. </view>
  11. </template>
  12. </u-navbar>
  13. <view class="replenishment-detail-body" :style="`backgroundImage:linear-gradient(180deg, ${$config('primaryColor')}, #F5F6F7 12%)`">
  14. <view class="head-info" v-if="basicInfoData">
  15. <view class="states">
  16. <view>
  17. <u-icon :name="pageType=='success'?'icon_complete':'icon_cancel'" custom-prefix="iscm-icon" size="48"></u-icon>
  18. <text>{{pageType=='success'?'已完成':'已取消'}}</text>
  19. </view>
  20. </view>
  21. <view>
  22. <view class="label"><u-icon name="dingdanhao" custom-prefix="iscm-icon" size="32"></u-icon><text>补货单号</text></view>
  23. <view class="info-txt">{{basicInfoData.replenishBillNo || '--'}}</view>
  24. </view>
  25. <view>
  26. <view class="label"><u-icon name="ison_shelf" custom-prefix="iscm-icon" size="32"></u-icon><text>货架名称</text></view>
  27. <view class="info-txt">{{basicInfoData.shelfInfo&&basicInfoData.shelfInfo.shelfName || '--'}}</view>
  28. </view>
  29. <!-- <view v-if="pageType=='success'">
  30. <view class="label"><u-icon name="icon_delivery" custom-prefix="iscm-icon" size="32"></u-icon><text>配送方式</text></view>
  31. <view class="info-txt">{{basicInfoData.dispatchTypeDictValue || '--'}}</view>
  32. </view> -->
  33. <view v-if="pageType=='success'">
  34. <view class="label"><u-icon name="xinxi" custom-prefix="iscm-icon" size="32"></u-icon><text>出库备注</text></view>
  35. <view class="info-txt">{{basicInfoData.remarks || '--'}}</view>
  36. </view>
  37. </view>
  38. <view class="part-list">
  39. <!-- 补货产品 -->
  40. <partList :list="partList" title="配件列表" model="view" :fromPage="pageType=='success'?'replenishmentDetail':'replenishmentDetailc'" ref="partList" noDataText="暂无产品"></partList>
  41. </view>
  42. </view>
  43. <!-- 生成销售单 -->
  44. <common-modal v-if="confirmModal" :top="salesOrderList.length?'20vh':'40vh'" :showTitle="false" :openModal="confirmModal" @confirm="modalConfirm" @close="confirmModal=false">
  45. <view style="font-size: 28upx;">
  46. <view style="padding: 10upx;margin: 20upx 0;" class="flex align_center justify_between">
  47. <view>产品总款数:<text style="color: red;">{{partList.length}}</text></view>
  48. <view>产品总件数:<text style="color: red;">{{totalNums}}</text></view>
  49. </view>
  50. <view v-if="salesOrderList.length">
  51. <view style="padding: 0 10upx 5upx;">此补货单已经存在对应的销售单?</view>
  52. <view style="padding: 0 10upx 20upx;">确认再次生成销售单吗?</view>
  53. <scroll-view :scroll-y="true" style="max-height: 18vh;">
  54. <view
  55. v-for="item in salesOrderList"
  56. :key="item.id"
  57. style="color: #00aaff;border-bottom: 1px solid #eee;padding: 10upx 0;"
  58. class="flex align_center justify_between"
  59. @click="viewSales(item)"
  60. >
  61. <text>{{item.salesBillNo}}</text>
  62. <view>
  63. <u-icon name="arrow-right"></u-icon>
  64. </view>
  65. </view>
  66. </scroll-view>
  67. </view>
  68. <view v-else>
  69. <view style="padding: 0 10upx 20upx;">确认生成销售单?</view>
  70. <view>
  71. <view
  72. v-for="item in salesOrderList" :key="item.id"
  73. style="color: #00aaff;border-bottom: 1px solid #eee;padding: 10upx 0;"
  74. class="flex align_center justify_between">
  75. <text>{{item.orderNo}}</text>
  76. <view>
  77. <u-icon name="arrow-right"></u-icon>
  78. </view>
  79. </view>
  80. </view>
  81. </view>
  82. </view>
  83. </common-modal>
  84. </view>
  85. </template>
  86. <script>
  87. import {
  88. shelfReplenishDetail,
  89. shelfReplenishDetailList,
  90. shelfReplenishPutStock,
  91. queryRelationSalesBill,
  92. createSalesBill} from '@/api/shelfReplenish'
  93. import { salesDetailBySn } from '@/api/sales'
  94. import partList from '@/pages/common/partList.vue'
  95. import commonModal from '@/pages/common/commonModal.vue'
  96. export default {
  97. components: { partList, commonModal },
  98. data() {
  99. return {
  100. confirmModal: false,
  101. replenishBillSn: '',
  102. basicInfoData:null,
  103. partList: [],
  104. salesOrderList:[],
  105. customStyle: {
  106. borderRadius:'100rpx',
  107. fontSize:'30rpx',
  108. background: this.$config('primaryColor')
  109. },
  110. pageType: ''
  111. }
  112. },
  113. onReady() {
  114. uni.setNavigationBarColor({
  115. frontColor: '#ffffff',
  116. backgroundColor: this.$config('primaryColor')
  117. })
  118. },
  119. onBackPress() {
  120. if(this.showModal){
  121. this.showModal = false
  122. return true
  123. }
  124. },
  125. onLoad(option) {
  126. this.replenishBillSn = option.sn
  127. this.pageType = option.type
  128. this.getDetail()
  129. this.getPartList()
  130. this.getSalesOrder()
  131. },
  132. computed: {
  133. totalNums() {
  134. let ret = 0
  135. this.partList.map(item => {
  136. ret = ret + item.putQty
  137. })
  138. return ret
  139. }
  140. },
  141. methods: {
  142. // 查询详情
  143. getDetail(){
  144. shelfReplenishDetail({ sn: this.replenishBillSn }).then(res => {
  145. if(res.status == 200){
  146. this.basicInfoData = res.data || null
  147. }else{
  148. this.basicInfoData = null
  149. }
  150. })
  151. },
  152. // 查询列表
  153. getPartList(){
  154. const _this = this
  155. this.showLoading()
  156. shelfReplenishDetailList({ replenishBillSn: this.replenishBillSn }).then(res => {
  157. console.log(res.data)
  158. uni.hideLoading()
  159. if(res.status == 200 && res.data){
  160. this.partList = res.data || []
  161. }else{
  162. this.partList = []
  163. }
  164. })
  165. },
  166. // 查询关联销售单
  167. getSalesOrder () {
  168. queryRelationSalesBill({ replenishBillSn: this.replenishBillSn }).then(res => {
  169. if (res.status == 200) {
  170. this.salesOrderList = res.data
  171. } else {
  172. this.salesOrderList = []
  173. }
  174. })
  175. },
  176. // 生成销售单
  177. creatSalesOrder(){
  178. this.confirmModal = true
  179. },
  180. modalConfirm(){
  181. this.showLoading("正在生成销售单...")
  182. createSalesBill({ replenishBillSn: this.replenishBillSn }).then(res => {
  183. if (res.status == 200) {
  184. this.getSalesOrder()
  185. }
  186. this.confirmModal = false
  187. this.toashMsg(res.message)
  188. uni.hideLoading()
  189. })
  190. },
  191. // 查看销售单
  192. viewSales(data){
  193. salesDetailBySn({ salesBillSn: data.salesBillSn }).then(res => {
  194. if (res.data) {
  195. uni.navigateTo({ url: '/pages/sales/edit?pageType=detail&data='+JSON.stringify(data) })
  196. } else {
  197. this.toashMsg('此销售单已被删除!')
  198. }
  199. })
  200. }
  201. }
  202. }
  203. </script>
  204. <style lang="less">
  205. .replenishment-detail-wrap{
  206. position: relative;
  207. width: 100%;
  208. height: 100%;
  209. overflow: hidden;
  210. .replenishment-detail-body{
  211. padding: 0 30rpx;
  212. height: 100%;
  213. overflow: auto;
  214. > view{
  215. padding: 10rpx 25rpx;
  216. background-color: #fff;
  217. margin-bottom: 20rpx;
  218. border-radius: 25rpx;
  219. box-shadow: 2rpx 3rpx 5rpx #eee;
  220. }
  221. .head-info{
  222. .states{
  223. border: 0;
  224. padding: 20rpx 0;
  225. > view{
  226. color: #191919;
  227. text-align: center;
  228. font-size: 40rpx;
  229. text{
  230. margin-left: 20rpx;
  231. }
  232. }
  233. }
  234. .info-txt{
  235. word-break: break-word;
  236. }
  237. font-size: 30rpx;
  238. > view{
  239. display: flex;
  240. border-bottom: 2rpx solid #f5f5f5;
  241. padding: 20rpx 0;
  242. > view:last-child{
  243. flex-grow: 1;
  244. width: 80%;
  245. }
  246. &:last-child{
  247. border:0;
  248. }
  249. }
  250. .label{
  251. display: flex;
  252. align-items: center;
  253. width: 220rpx;
  254. height: 44rpx;
  255. color: #7C7D7E;
  256. text{
  257. margin-left: 10rpx;
  258. }
  259. }
  260. }
  261. }
  262. .replenishment-detail-footer{
  263. padding: 26upx 32upx 30upx;
  264. background-color: #fff;
  265. position: fixed;
  266. left: 0;
  267. bottom: 0;
  268. width: 100%;
  269. box-shadow: 3px 1px 7px #eee;
  270. }
  271. }
  272. </style>