sale.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. <template>
  2. <view class="home bg-f9">
  3. <header-bar addUrl="/sale/add" title="销售订单"></header-bar>
  4. <uni-search-bar v-model="req.keyword" placeholder="输入关键词" @confirm="search" @cancel="cancel" bgColor="#fff"
  5. cancel-text="取消">
  6. </uni-search-bar>
  7. <view class="common-list-box" v-for="(i,index) in dataList" :key="i.index" @click="toDtl(i)">
  8. <view class="text">
  9. <view class="text-list" v-for="(j,jndex) in config" :key="jndex">
  10. <span class="label">
  11. {{j.label}}
  12. </span>
  13. <span class="value">
  14. {{i[j.key]}}
  15. </span>
  16. </view>
  17. </view>
  18. <view class="more success">
  19. <view class="common-stat-box">
  20. 已出货
  21. </view>
  22. <uni-icons type="forward" class="icon" size="30"></uni-icons>
  23. </view>
  24. </view>
  25. <button type="default" @click="getList()" style="margin-top:10rpx">
  26. {{status == 'more' ? '点击加载更多' : status == 'noMore' ? '已经到底了' : '加载中..'}}
  27. </button>
  28. </view>
  29. </template>
  30. <script>
  31. import headerBar from '../../../components/header-bar/index.vue'
  32. import commonList from '../../../components/common-list/common-list.vue'
  33. import {formateObjToParamStr} from '../../../util/uitl.js'
  34. import Vue from 'vue'
  35. export default {
  36. components: {
  37. headerBar,
  38. commonList
  39. },
  40. data() {
  41. return {
  42. status: 'more',
  43. config: [{
  44. label: "客户名称",
  45. key: 'typeName',
  46. },
  47. {
  48. label: "下单日期",
  49. key: 'name',
  50. },
  51. {
  52. label: "订单金额",
  53. key: 'unit',
  54. }
  55. ],
  56. dataList: [],
  57. req: {
  58. pageNum: 1,
  59. pageSize: 10,
  60. keyword: null,
  61. },
  62. }
  63. },
  64. onLoad() {
  65. this.search()
  66. },
  67. onShow() {
  68. if(this.needRefresh) this.search();
  69. },
  70. methods: {
  71. toDtl(i){
  72. console.log(i)
  73. uni.navigateTo({
  74. url: '/pages/supplyChain/sale/add?' + formateObjToParamStr(i)
  75. })
  76. },
  77. cancel() {
  78. this.req.keyword = null
  79. },
  80. search() {
  81. this.req.pageNum = 1
  82. this.status = 'more'
  83. this.dataList = []
  84. this.getList()
  85. },
  86. getList() {
  87. const v = this
  88. if (v.status === 'more') {
  89. v.status = 'loading'
  90. } else {
  91. return
  92. }
  93. v.$post('/api/basics/product/page', v.req).then(res => {
  94. res.data.records.map(items => {
  95. items.typeName = (items.type === 0) ? '半成品' : '成品'
  96. })
  97. v.dataList = [...v.dataList, ...res.data.records]
  98. if (res.data.pages === v.req.pageNum || res.data.pages === 0) {
  99. v.status = 'noMore'
  100. } else {
  101. v.status = 'more'
  102. v.req.pageNum++
  103. }
  104. })
  105. },
  106. },
  107. }
  108. </script>
  109. <style lang="less">
  110. /deep/.bg-f9{
  111. background-color: #f9f9f9;
  112. min-height: 100vh;
  113. }
  114. /deep/.uni-forms-item{
  115. background-color: #fff;
  116. margin-bottom: 6rpx!important;
  117. padding: 6rpx 24rpx 26rpx!important;
  118. }
  119. /deep/.is-input-border{
  120. border:none!important;
  121. }
  122. .common-list-box{
  123. background-color: #fff;
  124. padding: 24rpx;
  125. margin-top: 6rpx;
  126. display: flex;
  127. justify-content: space-between;
  128. .text{
  129. .text-list{
  130. line-height: 60rpx;
  131. .label{
  132. color: #999999;
  133. }
  134. .value{
  135. color: #000;
  136. margin-left: 20rpx;
  137. }
  138. }
  139. }
  140. .common-stat-box{
  141. border:6rpx solid red;
  142. height: 80rpx;
  143. width: 80rpx;
  144. text-align: center;
  145. line-height: 80rpx;
  146. border-radius: 50%;
  147. position: relative;
  148. font-size: 20rpx;
  149. transform:rotate(-25deg);
  150. }
  151. .common-stat-box::before{
  152. display: block;
  153. position: absolute;
  154. width: 68rpx;
  155. height: 68rpx;
  156. left: 6rpx;
  157. top: 6rpx;
  158. border:2rpx solid red;
  159. border-radius: 50%;
  160. content: ' ';
  161. }
  162. .more{
  163. display: flex;
  164. align-items: center;
  165. }
  166. .success{
  167. .common-stat-box{
  168. border-color: #39C55A;
  169. color: #39C55A;
  170. }
  171. .common-stat-box::before{
  172. border-color: #39C55A;
  173. }
  174. }
  175. .error{
  176. .common-stat-box{
  177. border-color: #F94539;
  178. color: #F94539;
  179. }
  180. .common-stat-box::before{
  181. border-color: #F94539;
  182. }
  183. }
  184. .warning{
  185. .common-stat-box{
  186. border-color: #FF9315;
  187. color: #FF9315;
  188. }
  189. .common-stat-box::before{
  190. border-color: #FF9315;
  191. }
  192. }
  193. }
  194. </style>