salesDetail.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364
  1. <template>
  2. <view class="sales-edit-wrap flex flex_column">
  3. <!-- 基础信息 -->
  4. <view class="sales-info-con">
  5. <u-section @click="infoModal=true" title="基础信息" sub-title="查看更多" :line-color="$config('primaryColor')"></u-section>
  6. <view class="info-item-box">
  7. <text class="info-item-tit color_6">客户名称</text>
  8. <text>{{detailData && detailData.buyerName || '--'}}</text>
  9. </view>
  10. <view class="info-item-box">
  11. <text class="info-item-tit color_6">销售单号</text>
  12. <text>{{detailData && detailData.salesBillNo || '--'}}</text>
  13. </view>
  14. </view>
  15. <!-- 产品列表 -->
  16. <view class="sales-product-con">
  17. <!-- 标题 -->
  18. <view class="sales-product-header">
  19. <u-tabs :show-bar="false" :active-item-style="activeItemStyle" :list="tabsList" :is-scroll="false" :current="current" @change="changeTabs"></u-tabs>
  20. </view>
  21. <view class="flex flex_column" v-show="current == 0">
  22. <!-- 合计 -->
  23. <view ref="salesTotal" v-if="detailData" class="sales-total-box border-b font_13 flex justify_between">
  24. <view class="sales-total-con flex_1">
  25. <view>
  26. 总款数:<text class="sales-total-num" :style="{ color: $config('warringColor') }">
  27. {{ (detailData.totalCategory || detailData.totalCategory == 0) ? toThousands(detailData.totalCategory) : '--' }}</text>;
  28. 总数量:<text class="sales-total-num" :style="{ color: $config('warringColor') }">
  29. {{ (detailData.totalQty || detailData.totalQty == 0) ? toThousands(detailData.totalQty) : '--' }}
  30. </text>;
  31. </view>
  32. <view>
  33. 总售价:<text class="sales-total-num" :style="{ color: $config('warringColor') }">
  34. ¥{{ detailData.totalAmount || detailData.totalAmount == 0 ? toThousands(detailData.totalAmount, 2) : '--' }}
  35. </text>;
  36. 折后总售价:<text class="sales-total-num" :style="{ color: $config('warringColor') }">
  37. ¥{{ detailData.discountedAmount || detailData.discountedAmount == 0 ? toThousands(detailData.discountedAmount, 2) : '--' }}
  38. </text>;
  39. </view>
  40. </view>
  41. </view>
  42. <!-- 产品列表 -->
  43. <view class="sales-list-box">
  44. <scroll-view class="sales-list-con" :style="{height:scrollH+'upx'}" scroll-y @scrolltolower="onreachBottom">
  45. <view class="sales-list-item border-b flex align_center justify_between" v-for="(item, index) in listData" :key="item.id">
  46. <view class="font_13 flex_1 flex justify_between">
  47. <view class="pimgs">
  48. <u-image :src="item.productMainImage?item.productMainImage:`../../static/${$config('themePath')}/def_img@2x.png`" width="128" height="128" border-radius="10"></u-image>
  49. <view v-if="item.oosFlag == 1" class="sign" :style="{backgroundColor: $config('errorColor')}">急</view>
  50. <view v-if="item.price < item.cost" class="sign" :style="{backgroundColor: $config('errorColor')}">亏</view>
  51. <view v-if="item.price == 0" class="sign" :style="{backgroundColor: $config('errorColor')}">赠</view>
  52. </view>
  53. <view class="sales-item-main flex_1">
  54. <view class="sales-item-name">{{item.productName || '--'}}</view>
  55. <view class="sales-item-txt">{{item.productCode || '--'}}</view>
  56. <!-- <view class="sales-item-txt color_6" style="font-size: 24upx;" v-if="item.warehouseEntity&&item.warehouseEntity.name || item.warehouseLocationEntity&&item.warehouseLocationEntity.name">{{item.warehouseEntity&&item.warehouseEntity.name}} > {{item.warehouseLocationEntity&&item.warehouseLocationEntity.name}}</view> -->
  57. <view class="sales-item-txt flex align_center justify_between">
  58. <view class="sales-item-priceInfo">
  59. <view :style="{color: $config('errorColor'), display: 'inline-block'}">¥<text style="font-size: 30upx;">{{toThousands(item.price||0, 2)}}</text></view>
  60. <text style="display: inline-block;margin: 0 10upx;">X</text>
  61. <text style="font-size: 30upx;">{{toThousands(item.qty||0)}}</text>
  62. <!-- {{item.productUnit}} -->
  63. </view>
  64. <view class="sales-item-price">¥{{item.totalAmount || item.totalAmount == 0?toThousands(item.totalAmount, 2):0}}</view>
  65. </view>
  66. <!-- <view class="sales-item-price" v-if="detailData&&detailData.discountAmount">折后:¥{{toThousands(item.discountedAmount||0, 2)}}</view> -->
  67. </view>
  68. </view>
  69. </view>
  70. <view v-if="listData && listData.length == 0">
  71. <u-empty :src="`/static/${$config('themePath')}/def_no_data@3x.png`" icon-size="150" :text="noDataText" mode="list" :margin-top="50"></u-empty>
  72. </view>
  73. <view style="padding: 20upx;" v-else>
  74. <u-loadmore v-if="totalNum>listData.length || status=='loading'" :status="status" />
  75. </view>
  76. </scroll-view>
  77. </view>
  78. </view>
  79. <!-- 收款记录列表 -->
  80. <view class="flex flex_column" v-show="current == 1">
  81. <view class="sales-list-box">
  82. <scroll-view class="sales-list-con" :style="{height:scrollH+'upx'}" scroll-y>
  83. <view class="sales-list-item flex align_center justify_between" v-for="(con,i) in payRecode" :key="">
  84. <view class="sales-list-l">
  85. <view>{{con.createDate}}</view>
  86. <view>{{con.payType}}</view>
  87. </view>
  88. <view class="sales-list-r income" >
  89. {{con.price *1 > 0?'+':'-'}}¥{{con.price}}
  90. </view>
  91. </view>
  92. <view v-if="payRecode.length==0">
  93. <u-empty :src="`/static/${$config('themePath')}/def_no_data@3x.png`" icon-size="150" :text="noDataText" mode="list" :margin-top="50"></u-empty>
  94. </view>
  95. </scroll-view>
  96. </view>
  97. </view>
  98. </view>
  99. <!-- 基础信息 -->
  100. <orderInfoModal :infoFlag="true" :openModal="infoModal" :infoData="detailData" @close="infoModal=false" />
  101. </view>
  102. </template>
  103. <script>
  104. import OrderInfoModal from './orderInfoModal.vue'
  105. import { toThousands } from '@/libs/tools'
  106. import { salesDetailList, salesDetailDel, salesDel, salesDetailBySn, salesSubmit, salesDiscount, salesDetailUpdate,queryFlowByBizSn } from '@/api/sales'
  107. export default{
  108. components: { OrderInfoModal },
  109. data(){
  110. return{
  111. tabsList:[{
  112. name:'产品列表'
  113. },{
  114. name:'收款记录'
  115. }],
  116. current:0,
  117. activeItemStyle:{
  118. color:this.$config('primaryColor'),
  119. borderBottom:'4rpx solid '+this.$config('primaryColor')
  120. },
  121. toThousands,
  122. listData: [],
  123. pageNo: 1,
  124. pageSize: 10,
  125. totalNum: 0,
  126. status: 'loadmore',
  127. noDataText: '暂无数据',
  128. scrollH: 916,
  129. infoModal: false,
  130. discountModal: false,
  131. commonModal: false,
  132. modalText: '确认要删除吗?',
  133. detailData: null, // 销售单详情
  134. openProductModal: false, // 编辑产品信息弹框是否显示
  135. productData: null, // 当前操作的产品信息
  136. productInfo: null, // 编辑产品需要的参数
  137. editInfo: null, // 添加/编辑 提交的值
  138. commonType: 1, // 公共弹框类型 1删除产品,2删除销售单,3编辑产品时库存不足
  139. payRecode:[]
  140. }
  141. },
  142. onLoad(options) {
  143. if(options && options.salesBillId){
  144. this.salesBillSn = options.salesBillId;
  145. this.init();
  146. }
  147. },
  148. onUnload() {
  149. uni.$off('refreshEditBL')
  150. },
  151. methods: {
  152. //获取收款记录
  153. getRecodeData(pageNo){
  154. if (pageNo) {
  155. this.pageNo = pageNo
  156. }
  157. queryFlowByBizSn({bizSn: this.salesBillSn}).then(res => {
  158. if (res.status == 200) {
  159. this.payRecode =res.data
  160. }
  161. })
  162. },
  163. changeTabs(index){
  164. this.current= index
  165. },
  166. init(){
  167. this.getList(1)
  168. this.getDetail()
  169. this.getRecodeData(1)
  170. },
  171. // 销售单详情
  172. getDetail(){
  173. salesDetailBySn({ salesBillSn: this.salesBillSn }).then(res => {
  174. if(res.status == 200){
  175. this.detailData = res.data
  176. }else{
  177. this.detailData = null
  178. }
  179. this.toggle = false
  180. })
  181. },
  182. // 列表
  183. getList(pageNo){
  184. const _this = this
  185. if (pageNo) {
  186. this.pageNo = pageNo
  187. }
  188. let params = {
  189. pageNo: this.pageNo,
  190. pageSize: this.pageSize,
  191. salesBillSn: this.salesBillSn
  192. }
  193. this.status = "loading"
  194. salesDetailList(params).then(res => {
  195. if (res.status == 200) {
  196. if(res.data && res.data.list){
  197. res.data.list.map(item => {
  198. item.productName = item.productEntity && item.productEntity.name || item.dealerProductEntity && item.dealerProductEntity.name
  199. item.productCode = item.productEntity && item.productEntity.code || item.dealerProductEntity && item.dealerProductEntity.code
  200. item.productUnit = item.productEntity && item.productEntity.unit || item.dealerProductEntity && item.dealerProductEntity.unit
  201. })
  202. if(this.pageNo>1){
  203. this.listData = this.listData.concat(res.data && res.data.list || [])
  204. }else{
  205. this.listData = res.data.list || []
  206. }
  207. }else{
  208. this.listData = []
  209. }
  210. this.totalNum = res.data && res.data.count || 0
  211. } else {
  212. this.listData = []
  213. this.totalNum = 0
  214. this.noDataText = res.message
  215. }
  216. this.status = "loadmore"
  217. })
  218. },
  219. // scroll-view到底部加载更多
  220. onreachBottom() {
  221. if(this.listData.length < this.totalNum){
  222. this.pageNo += 1
  223. this.getList()
  224. this.getRecodeData()
  225. }
  226. }
  227. }
  228. }
  229. </script>
  230. <style lang="scss">
  231. .sales-edit-wrap{
  232. width: 100%;
  233. .color_6{
  234. color: #666;
  235. }
  236. .font_13{
  237. font-size: 26upx;
  238. }
  239. .border-b{
  240. border-bottom: 1px solid #e4e7ed;
  241. }
  242. .sales-info-con{
  243. background-color: #fff;
  244. margin-bottom: 6upx;
  245. >view{
  246. padding: 14upx 20rpx;
  247. border-bottom: 1px solid #e4e7ed;
  248. }
  249. >view:last-child{
  250. border-bottom: none;
  251. }
  252. .info-item-box{
  253. .info-item-tit{
  254. display: inline-block;
  255. width: 20%;
  256. }
  257. }
  258. }
  259. .sales-product-con{
  260. background-color: #fff;
  261. .sales-product-header{
  262. /deep/.u-tab-item{
  263. border-bottom:1rpx solid #e4e7ed;
  264. }
  265. }
  266. .sales-total-box{
  267. align-items: flex-end;
  268. padding: 16upx 20rpx;
  269. .sales-total-con{
  270. color: #666;
  271. overflow: hidden;
  272. view{
  273. padding: 4upx 0;
  274. .sales-total-num{
  275. font-size: 24upx;
  276. color: rgb(48, 49, 51);
  277. }
  278. }
  279. }
  280. .sales-total-btn{
  281. display: inline-block;
  282. margin-bottom: 6upx;
  283. }
  284. }
  285. .sales-list-box{
  286. flex-grow: 1;
  287. .sales-list-con{
  288. .sales-list-item{
  289. padding: 20upx;
  290. .pimgs{
  291. margin-right: 20upx;
  292. position: relative;
  293. .sign{
  294. position: absolute;
  295. right: -2upx;
  296. top: -2upx;
  297. color: #fff;
  298. border-radius: 50%;
  299. width: 40upx;
  300. height: 40upx;
  301. text-align: center;
  302. }
  303. }
  304. .sales-item-main{
  305. .sales-item-name{
  306. font-size: 28upx;
  307. color: rgb(48, 49, 51);
  308. font-weight: bold;
  309. overflow: hidden;
  310. text-overflow: ellipsis;
  311. display: -webkit-box;
  312. -webkit-box-orient: vertical;
  313. -webkit-line-clamp: 1;
  314. }
  315. .sales-item-txt{
  316. margin: 8upx 0;
  317. }
  318. .sales-item-price{
  319. text-align: right;
  320. }
  321. }
  322. .btn-box{
  323. padding: 30upx 30upx;
  324. }
  325. .sales-list-l{
  326. font-size: 20rpx;
  327. view{
  328. &:last-child{
  329. font-size: 26rpx;
  330. margin-top:10rpx;
  331. }
  332. }
  333. }
  334. .sales-list-r.spending{
  335. color:$uni-color-error;
  336. }
  337. .sales-list-r.income{
  338. color:$uni-color-success;
  339. }
  340. }
  341. .sales-list-item:last-child{
  342. border: none;
  343. }
  344. }
  345. }
  346. }
  347. .sales-btn-box{
  348. background-color: #fff;
  349. padding: 12upx 50upx;
  350. .handle-btn{
  351. width: 47%;
  352. }
  353. .edit-btn{
  354. width: 100%;
  355. }
  356. }
  357. }
  358. </style>