listComponent.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  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 { salesList, salesWriteAudit, salesWriteStockOut, salesDel } from '@/api/sales'
  57. export default{
  58. components: { commonModal },
  59. props: {
  60. height: { // 非滚动区域高度 upx
  61. type: String || Number,
  62. default: 300
  63. },
  64. params: { // 列表查询条件
  65. type: Object,
  66. default: () => {
  67. return {}
  68. }
  69. }
  70. },
  71. data(){
  72. return{
  73. listData: [],
  74. pageNo: 1,
  75. pageSize: 10,
  76. totalNum: 0,
  77. status: 'loadmore',
  78. noDataText: '暂无数据',
  79. toThousands,
  80. auditModal: false, // 审核弹框
  81. dataInfo: null,
  82. outModal: false, // 出库弹框
  83. delModal: false, // 删除/取消弹框
  84. delText: '确认要删除吗?',
  85. scrollH: 300
  86. }
  87. },
  88. mounted() {
  89. const _this = this
  90. uni.getSystemInfo({
  91. success: function (res) {
  92. const winH = res.windowHeight * 2
  93. _this.scrollH = winH - _this.height - 85
  94. }
  95. })
  96. this.getList()
  97. },
  98. methods:{
  99. // 列表
  100. getList(pageNo){
  101. const _this = this
  102. if (pageNo) {
  103. this.pageNo = pageNo
  104. }
  105. let params = {
  106. pageNo: this.pageNo,
  107. pageSize: this.pageSize
  108. }
  109. this.status = "loading"
  110. salesList(Object.assign(params, this.params)).then(res => {
  111. if (res.status == 200) {
  112. if(this.pageNo>1){
  113. this.listData = this.listData.concat(res.data.list || [])
  114. }else{
  115. this.listData = res.data.list || []
  116. }
  117. this.totalNum = res.data.count || 0
  118. } else {
  119. this.listData = []
  120. this.totalNum = 0
  121. this.noDataText = res.message
  122. }
  123. this.status = "loadmore"
  124. })
  125. },
  126. // scroll-view到底部加载更多
  127. onreachBottom() {
  128. if(this.listData.length < this.totalNum){
  129. this.pageNo += 1
  130. this.getList()
  131. }
  132. },
  133. // 查看详情
  134. getDetail(data){
  135. uni.navigateTo({ url: '/pages/sales/edit?pageType=detail&data='+JSON.stringify(data) })
  136. },
  137. // 编辑
  138. handleEdit(data){
  139. uni.navigateTo({ url: '/pages/sales/edit?pageType=edit&data='+JSON.stringify(data) })
  140. },
  141. // 操作
  142. handleFun(type, data){
  143. this.dataInfo = data
  144. if(type == 'audit'){ // 审核
  145. this.auditModal = true
  146. }else if(type == 'out'){ // 出库
  147. this.outModal = true
  148. }else if(type == 'del'){ // 删除
  149. this.delText = '确认要删除吗?'
  150. this.delModal = true
  151. }else if(type == 'cancel'){ // 取消
  152. this.delText = '确认要取消吗?'
  153. this.delModal = true
  154. }
  155. },
  156. // 审核通过或不通过
  157. handleAudit(billStatus){
  158. salesWriteAudit({
  159. id: this.dataInfo.id,
  160. billStatus: billStatus
  161. }).then(res => {
  162. if (res.status == 200) {
  163. this.toashMsg(res.message)
  164. this.getList(1)
  165. this.auditModal = false
  166. } else {
  167. this.auditModal = false
  168. }
  169. })
  170. },
  171. // 出库
  172. handleOut(){
  173. salesWriteStockOut({ salesBillSn: this.dataInfo.salesBillSn }).then(res => {
  174. if (res.status == 200) {
  175. this.toashMsg(res.message)
  176. this.getList(1)
  177. this.outModal = false
  178. } else {
  179. this.outModal = false
  180. }
  181. })
  182. },
  183. // 删除
  184. handleDel(){
  185. salesDel({ id: this.dataInfo.id }).then(res => {
  186. if (res.status == 200) {
  187. this.toashMsg(res.message)
  188. this.getList(1)
  189. this.delModal = false
  190. } else {
  191. this.delModal = false
  192. }
  193. })
  194. }
  195. }
  196. }
  197. </script>
  198. <style lang="scss">
  199. .sales-list-component{
  200. .color_6{
  201. color: #666;
  202. }
  203. .font_13{
  204. font-size: 26upx;
  205. }
  206. .sales-list-con{
  207. .sales-list-main{
  208. .sales-list-item{
  209. background: #ffffff;
  210. padding: 20upx;
  211. margin-bottom: 25upx;
  212. border-radius: 25upx;
  213. box-shadow: 1px 1px 3px #EEEEEE;
  214. .list-item-tit{
  215. padding-bottom: 18upx;
  216. padding-top: 10upx;
  217. border-bottom: 1px solid #e4e7ed;
  218. white-space: nowrap;
  219. overflow: hidden;
  220. text-overflow: ellipsis;
  221. .u-line{
  222. display: inline-block;
  223. width: 8upx;
  224. height: 40upx;
  225. background-color: red;
  226. vertical-align: bottom;
  227. margin: 0 20upx 0 10upx;
  228. }
  229. }
  230. .list-item-con{
  231. padding: 10upx 0;
  232. .list-item-line{
  233. padding: 8upx 0;
  234. }
  235. text{
  236. color: #666;
  237. }
  238. }
  239. .button-box{
  240. text-align: right;
  241. button{
  242. margin: 0 10upx;
  243. }
  244. }
  245. }
  246. }
  247. }
  248. }
  249. </style>