listComponent.vue 9.3 KB

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