detail.vue 7.8 KB

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