listComponent.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. <template>
  2. <view class="sales-list-component">
  3. <scroll-view class="sales-list-con" :style="{height: scrollH+'upx'}" scroll-y @scrolltolower="onreachBottom">
  4. <view class="sales-list-main">
  5. <view class="sales-list-item" v-for="(item, index) in listData" :key="item.id" @click="getDetail(item)">
  6. <view class="list-item-tit">
  7. <u-section :title="item.buyerName" :sub-title="item.billStatusDictValue" :line-color="$config('primaryColor')"></u-section>
  8. </view>
  9. <view class="list-item-con">
  10. <view class="list-item-line flex align_center justify_between">
  11. <view>
  12. <view style="display: inline-block;margin-right: 6upx;">{{item.salesBillNo}}</view>
  13. <u-tag v-if="item.oosFlag==1" text="急件" :bg-color="$config('errorColor')" mode="dark" shape="circle" size="mini" style="margin-right: 6upx;vertical-align: text-top;" />
  14. <u-tag v-if="item.salesBillSourceDictValue" :text="item.salesBillSourceDictValue" :bg-color="$config('primaryColor')" mode="dark" shape="circle" size="mini" style="vertical-align: text-top;" />
  15. </view>
  16. <view class="color_6 font_13">{{item.createDate || '--'}}</view>
  17. </view>
  18. <view class="list-item-line flex align_center justify_between">
  19. <view>总款数:<text>{{toThousands(item.totalCategory||0)}}</text></view>
  20. <view>总数量:<text>{{toThousands(item.totalQty||0)}}</text></view>
  21. <view>总售价:<text>¥{{toThousands(item.totalAmount||0, 2)}}</text></view>
  22. </view>
  23. <view class="list-item-line flex align_center justify_between">
  24. <view class="flex_1">财务状态:<text>{{item.financialStatusDictValue||'--'}}</text></view>
  25. <view class="flex_1">收款方式:<text>{{item.settleStyleEntity&&item.settleStyleEntity.name||'--'}}</text></view>
  26. </view>
  27. </view>
  28. <!-- <view class="button-box">
  29. <u-button @click="handleFun('audit', item)" size="mini" :hair-line="false" shape="circle" plain type="primary" hover-class="none" v-if="item.billStatus == 'WAIT_AUDIT'">审核</u-button>
  30. <u-button @click="handleFun('out', item)" size="mini" :hair-line="false" shape="circle" plain type="primary" hover-class="none" v-if="item.billStatus == 'WAIT_OUT_WAREHOUSE'">出库</u-button>
  31. <u-button @click="handleEdit(item)" size="mini" :hair-line="false" shape="circle" plain type="primary" hover-class="none" v-if="(item.salesBillSource == 'SATELLITE' || item.salesBillSource == 'SALES' || item.salesBillSource == 'TEMPORARY_DISPATCHING') && (item.billStatus == 'WAIT_AUDIT' || item.billStatus == 'WAIT_SUBMIT' || item.billStatus == 'AUDIT_REJECT')">编辑</u-button>
  32. <u-button @click="handleFun('del', item)" size="mini" :hair-line="false" shape="circle" plain type="error" hover-class="none" v-if="((item.salesBillSource == 'SATELLITE' || item.salesBillSource == 'SALES' || item.salesBillSource == 'TEMPORARY_DISPATCHING') && item.billStatus != 'FINISH')">删除</u-button>
  33. <u-button @click="handleEdit(item)" size="mini" :hair-line="false" shape="circle" plain type="primary" hover-class="none" v-if="item.salesBillSource == 'PURCHASE' && (item.billStatus == 'WAIT_AUDIT' || item.billStatus == 'SUPERIOR_CHANGE')">改单</u-button>
  34. <u-button @click="handleFun('cancel', item)" size="mini" :hair-line="false" shape="circle" plain type="primary" hover-class="none" v-if="item.salesBillSource == 'PURCHASE' && (item.billStatus == 'WAIT_AUDIT' || item.billStatus == 'SUPERIOR_CHANGE')">取消</u-button>
  35. </view> -->
  36. </view>
  37. <view v-if="listData && listData.length == 0">
  38. <u-empty :text="noDataText" mode="list" :img-width="200" :margin-top="30"></u-empty>
  39. </view>
  40. <view style="padding-bottom: 20upx;">
  41. <u-loadmore v-if="totalNum>listData.length || status=='loading'" :status="status" />
  42. </view>
  43. </view>
  44. </scroll-view>
  45. <!-- 审核弹框 -->
  46. <common-modal :openModal="auditModal" content="请点击下方按钮确认操作" confirmText="审核通过" cancelText="审核不通过" :isClose="true" @confirm="handleAudit('WAIT_OUT_WAREHOUSE')" @cancel="handleAudit('AUDIT_REJECT')" @close="auditModal=false" />
  47. <!-- 出库弹框 -->
  48. <common-modal :openModal="outModal" content="确认要出库吗?" @confirm="handleOut" @close="outModal=false" />
  49. <!-- 删除/取消弹框 -->
  50. <common-modal :openModal="delModal" :content="delText" @confirm="handleDel" @close="delModal=false" />
  51. </view>
  52. </template>
  53. <script>
  54. import commonModal from '@/pages/common/commonModal.vue'
  55. import { toThousands } from '@/libs/tools'
  56. import copyText from '@/pages/common/copyText.vue'
  57. import { salesList, salesWriteAudit, salesWriteStockOut, salesDel } from '@/api/sales'
  58. export default{
  59. components: { commonModal, copyText },
  60. props: {
  61. height: { // 非滚动区域高度 upx
  62. type: String || Number,
  63. default: 300
  64. },
  65. params: { // 列表查询条件
  66. type: Object,
  67. default: () => {
  68. return {}
  69. }
  70. }
  71. },
  72. data(){
  73. return{
  74. listData: [],
  75. pageNo: 1,
  76. pageSize: 10,
  77. totalNum: 0,
  78. status: 'loadmore',
  79. noDataText: '暂无数据',
  80. toThousands,
  81. auditModal: false, // 审核弹框
  82. dataInfo: null,
  83. outModal: false, // 出库弹框
  84. delModal: false, // 删除/取消弹框
  85. delText: '确认要删除吗?',
  86. scrollH: 300
  87. }
  88. },
  89. mounted() {
  90. const _this = this
  91. uni.getSystemInfo({
  92. success: function (res) {
  93. const winH = res.windowHeight * 2
  94. _this.scrollH = winH - _this.height - 85
  95. }
  96. })
  97. this.getList()
  98. },
  99. methods:{
  100. // 列表
  101. getList(pageNo){
  102. const _this = this
  103. if (pageNo) {
  104. this.pageNo = pageNo
  105. }
  106. let params = {
  107. pageNo: this.pageNo,
  108. pageSize: this.pageSize
  109. }
  110. this.status = "loading"
  111. salesList(Object.assign(params, this.params)).then(res => {
  112. if (res.status == 200) {
  113. if(this.pageNo>1){
  114. this.listData = this.listData.concat(res.data.list || [])
  115. }else{
  116. this.listData = res.data.list || []
  117. }
  118. this.totalNum = res.data.count || 0
  119. } else {
  120. this.listData = []
  121. this.totalNum = 0
  122. this.noDataText = res.message
  123. }
  124. this.status = "loadmore"
  125. })
  126. },
  127. // scroll-view到底部加载更多
  128. onreachBottom() {
  129. if(this.listData.length < this.totalNum){
  130. this.pageNo += 1
  131. this.getList()
  132. }
  133. },
  134. // 查看详情
  135. getDetail(data){
  136. uni.navigateTo({ url: '/pages/sales/edit?pageType=detail&data='+JSON.stringify(data) })
  137. },
  138. // 编辑
  139. handleEdit(data){
  140. uni.navigateTo({ url: '/pages/sales/edit?pageType=edit&data='+JSON.stringify(data) })
  141. },
  142. // 操作
  143. handleFun(type, data){
  144. this.dataInfo = data
  145. if(type == 'audit'){ // 审核
  146. this.auditModal = true
  147. }else if(type == 'out'){ // 出库
  148. this.outModal = true
  149. }else if(type == 'del'){ // 删除
  150. this.delText = '确认要删除吗?'
  151. this.delModal = true
  152. }else if(type == 'cancel'){ // 取消
  153. this.delText = '确认要取消吗?'
  154. this.delModal = true
  155. }
  156. },
  157. // 审核通过或不通过
  158. handleAudit(billStatus){
  159. salesWriteAudit({
  160. id: this.dataInfo.id,
  161. billStatus: billStatus
  162. }).then(res => {
  163. if (res.status == 200) {
  164. this.toashMsg(res.message)
  165. this.getList(1)
  166. this.auditModal = false
  167. } else {
  168. this.auditModal = false
  169. }
  170. })
  171. },
  172. // 出库
  173. handleOut(){
  174. salesWriteStockOut({ salesBillSn: this.dataInfo.salesBillSn }).then(res => {
  175. if (res.status == 200) {
  176. this.toashMsg(res.message)
  177. this.getList(1)
  178. this.outModal = false
  179. } else {
  180. this.outModal = false
  181. }
  182. })
  183. },
  184. // 删除
  185. handleDel(){
  186. salesDel({ id: this.dataInfo.id }).then(res => {
  187. if (res.status == 200) {
  188. this.toashMsg(res.message)
  189. this.getList(1)
  190. this.delModal = false
  191. } else {
  192. this.delModal = false
  193. }
  194. })
  195. }
  196. }
  197. }
  198. </script>
  199. <style lang="scss">
  200. .sales-list-component{
  201. .color_6{
  202. color: #666;
  203. }
  204. .font_13{
  205. font-size: 26upx;
  206. }
  207. .sales-list-con{
  208. .sales-list-main{
  209. .sales-list-item{
  210. background: #ffffff;
  211. padding: 20upx;
  212. margin-bottom: 25upx;
  213. border-radius: 25upx;
  214. box-shadow: 1px 1px 3px #EEEEEE;
  215. .list-item-tit{
  216. padding-bottom: 18upx;
  217. padding-top: 10upx;
  218. border-bottom: 1px solid #e4e7ed;
  219. white-space: nowrap;
  220. overflow: hidden;
  221. text-overflow: ellipsis;
  222. .u-line{
  223. display: inline-block;
  224. width: 8upx;
  225. height: 40upx;
  226. background-color: red;
  227. vertical-align: bottom;
  228. margin: 0 20upx 0 10upx;
  229. }
  230. }
  231. .list-item-con{
  232. padding: 10upx 0;
  233. .list-item-line{
  234. padding: 8upx 0;
  235. }
  236. text{
  237. color: #666;
  238. }
  239. }
  240. .button-box{
  241. text-align: right;
  242. button{
  243. margin: 0 10upx;
  244. }
  245. }
  246. }
  247. }
  248. }
  249. }
  250. </style>