listComponent.vue 9.4 KB

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