summary.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327
  1. <template>
  2. <view class="price">
  3. <view class="picker-btn">
  4. <view class="btn">
  5. <button type="primary" @click="showPicker=true">
  6. {{$t('approval.gather')}}
  7. </button>
  8. </view>
  9. <view class="btn">
  10. <button type="primary" @click="sureChangePrice">
  11. {{$t('approval.affirmGather')}}
  12. </button>
  13. </view>
  14. </view>
  15. <u-sticky bgColor="#fff">
  16. <view class="change-price-title">
  17. <u-form labelPosition="left" :model="form" :rules="rules" ref="form1" >
  18. <!-- 开始日期 -->
  19. <u-form-item :label="$t('base.common.startDate')" borderBottom prop="startDate" @click="showSetDateCalendar = true">
  20. <u-input readonly v-model="form.startDate" border="none" :placeholder="$t('base.common.placeholderS')+$t('base.common.startDate')" />
  21. </u-form-item>
  22. <!-- 结束日期 -->
  23. <u-form-item :label="$t('base.common.endDate')" borderBottom prop="endDate" @click="showEndDateCalendar = true">
  24. <u-input readonly v-model="form.endDate" border="none" :placeholder="$t('base.common.placeholderS')+$t('base.common.endDate')" />
  25. </u-form-item>
  26. </u-form>
  27. </view>
  28. </u-sticky>
  29. <template v-if="newGatherIdList.length">
  30. <view class="order-card" v-for="(item, index) in newGatherIdList" :key="index">
  31. <view class="order-info">
  32. <p class="info-line">
  33. <text class="label">{{$t('spare.spareName')}}:</text>
  34. <text class="info">{{`${item.materialCode}_${item.materialName}_${item.materialSpec}`}}</text>
  35. </p>
  36. <p class="info-line">
  37. <text class="label">{{$t('spare.orderNum')}}:</text>
  38. <text class="info">{{item.purchNumber}}</text>
  39. </p>
  40. </view>
  41. </view>
  42. <!-- <p class="details-line details-title">
  43. <span >{{$t('spare.spareName')}}</span>
  44. <span>{{$t('spare.orderNum')}}</span>
  45. </p>
  46. <p v-for="(item,index) in newGatherIdList" :key="index" class="details-line">
  47. <span>{{item.materialName}}</span>
  48. <span>{{item.purchNumber}}</span>
  49. </p> -->
  50. </template>
  51. <template v-else>
  52. <u-empty mode="list" text='请先选择汇总信息' icon="https://cdn.uviewui.com/uview/empty/list.png">
  53. </u-empty>
  54. </template>
  55. <u-popup :show="showPicker" mode="center" zIndex="998" :overlay="false" @close="showView = false" >
  56. <view class="picker-card">
  57. <!-- 选择汇总信息 -->
  58. <view class="choose-wrap" v-if="gatherList.length>0">
  59. <view class="item">
  60. <view class="search-wrap">
  61. {{$t('approval.gatherSelection')}}:
  62. </view>
  63. <u-checkbox-group
  64. v-model="gatherIds"
  65. placement="column"
  66. >
  67. <u-checkbox
  68. :customStyle="{marginBottom: '8px'}"
  69. v-for="(item, index) in gatherList"
  70. :key="index"
  71. :label="item.collectCode+'-'+item.materialName+'-'+item.purchNumber"
  72. :name="JSON.stringify(item)"
  73. >
  74. </u-checkbox>
  75. </u-checkbox-group>
  76. </view>
  77. </view>
  78. <view v-else>
  79. <u-empty mode="list" text='暂无信息' icon="https://cdn.uviewui.com/uview/empty/list.png">
  80. </u-empty>
  81. </view>
  82. <view class="card-oper">
  83. <view class="btn">
  84. <button @click="showPicker = false">{{$t('settings.cancelText')}}</button>
  85. </view>
  86. <view class="btn">
  87. <button type='primary' @click="getGathers">{{$t('settings.confirmText')}}</button>
  88. </view>
  89. </view>
  90. </view>
  91. </u-popup>
  92. <u-calendar
  93. color="#4680F9"
  94. round='25'
  95. :show="showSetDateCalendar"
  96. @confirm="onSetDateConfirm"
  97. @close="showSetDateCalendar=false">
  98. </u-calendar>
  99. <u-calendar
  100. color="#4680F9"
  101. round='25'
  102. :show="showEndDateCalendar"
  103. @confirm="onEndDateConfirm"
  104. @close="showEndDateCalendar=false">
  105. </u-calendar>
  106. </view>
  107. </template>
  108. <script>
  109. import {
  110. getCollecDtlList
  111. } from "../../api/approval"
  112. import dayjs from 'dayjs'
  113. export default {
  114. data(){
  115. return {
  116. showSetDateCalendar:false,
  117. showEndDateCalendar:false,
  118. fixPrice:'',
  119. changePrice:null,
  120. showPicker:false,
  121. gatherList:[], //汇总选项列表
  122. keyword:'',
  123. proKeyword:'',
  124. gatherIds:[], //选择的汇总id
  125. newGatherIdList:[],//转换的汇总对象
  126. form:{
  127. startDate:dayjs().subtract(7,'day').format('YYYY-MM-DD 00:00:00'),
  128. endDate:dayjs().add(15, 'day').format('YYYY-MM-DD 23:59:59'),
  129. },
  130. rules: {
  131. startDate:[{ required: true, message: this.$t('base.common.placeholderS')+this.$t('base.common.startDate'), trigger: "change" }],
  132. endDate:[{ required: true, message: this.$t('base.common.placeholderS')+this.$t('base.common.endDate'), trigger: "change" }],
  133. },
  134. }
  135. },
  136. onLoad(options) {
  137. this.getGatherDetails();
  138. },
  139. methods:{
  140. //确认汇总
  141. sureChangePrice(){
  142. let pages = getCurrentPages();
  143. let prevPage = pages[pages.length - 2]; //上一个页面
  144. let details=[]
  145. this.newGatherIdList.forEach(item=>{
  146. details.push({
  147. materialid: item.materialid,
  148. materialName: item.materialName,
  149. materialCode:item.materialCode,
  150. materialSpec:item.materialSpec,
  151. price: item.price,
  152. number: item.purchNumber - item.orderNumber ,
  153. cess: item.cess,
  154. taxPrice: item.price * (1 + (item.cess / 100)),
  155. sourceId: item.id,
  156. })
  157. })
  158. prevPage.$vm.form.dtoList = details;
  159. uni.navigateBack();
  160. },
  161. //选择申请日期
  162. onSetDateConfirm(date){
  163. this.form.startDate = dayjs(date).format('YYYY-MM-DD 00:00:00');
  164. this.showSetDateCalendar = false;
  165. this.getGatherDetails();
  166. },
  167. //选择申请日期
  168. onEndDateConfirm(date){
  169. this.form.endDate = dayjs(date).format('YYYY-MM-DD 23:59:59');
  170. this.showEndDateCalendar = false;
  171. this.getGatherDetails();
  172. },
  173. //获取采购汇总信息
  174. getGatherDetails(){
  175. getCollecDtlList(this.form).then(res=>{
  176. console.log('==================',res);
  177. if(res.data.code == 0){
  178. this.gatherList=res.data.data
  179. }
  180. })
  181. },
  182. getGathers(){
  183. this.showPicker=false;
  184. this.gatherIds.forEach(item=>{
  185. this.newGatherIdList.push(JSON.parse(item));
  186. })
  187. }
  188. }
  189. }
  190. </script>
  191. <style lang="scss" scoped>
  192. @import '../../common/css/apply.scss';
  193. @import '../../common/css/approval.scss';
  194. /* #ifndef APP-NVUE */
  195. view {
  196. display: flex;
  197. box-sizing: border-box;
  198. flex-direction: column;
  199. }
  200. page {
  201. background-color: #f8f8f8;
  202. }
  203. /* #endif*/
  204. .price{
  205. /* #ifndef APP-NVUE */
  206. display: flex;
  207. width: 750rpx;
  208. min-height: 100vh;
  209. /* #endif */
  210. flex-direction: column;
  211. flex: 1;
  212. background-color: #f8f8f8;
  213. padding-bottom: 160rpx;
  214. .change-price-title{
  215. background-color: #fff;
  216. padding: 24rpx 32rpx;
  217. width: 100%;
  218. display: flex;
  219. .change-price-item{
  220. display: flex;
  221. flex-direction: row;
  222. align-items: center;
  223. margin-bottom: 24rpx;
  224. .btn{
  225. width: 20%;
  226. margin-left: 16rpx;
  227. }
  228. .inp{
  229. margin-left: 16rpx;
  230. flex: 1;
  231. }
  232. }
  233. }
  234. .details-wrap{
  235. padding: 32rpx;
  236. background: #fff;
  237. margin-top: 24rpx;
  238. .details-line{
  239. display: flex;
  240. flex-direction: row;
  241. line-height: 40px;
  242. span{
  243. width: 50%;
  244. font-size: 28rpx;
  245. text-align: center;
  246. }
  247. }
  248. .details-title{
  249. span{
  250. font-weight: bold;
  251. }
  252. }
  253. .details-line:nth-child(odd){
  254. background-color: #f2f2f2;
  255. }
  256. .details-line:nth-child(even){
  257. background-color: #fff;
  258. }
  259. }
  260. .picker-btn{
  261. padding: 32rpx;
  262. position: fixed;
  263. bottom: 0;
  264. width: 100%;
  265. flex-direction: row;
  266. justify-content: space-between;
  267. background-color: #fff;
  268. z-index: 75;
  269. .btn{
  270. width: 48%;
  271. }
  272. }
  273. // padding: 32rpx;
  274. .picker-card{
  275. padding: 32rpx 32rpx 144rpx;
  276. position: relative;
  277. height: 100%;
  278. overflow-y: scroll;
  279. .choose-wrap{
  280. display: flex;
  281. flex-direction: row;
  282. justify-content: space-around;
  283. height: 100%;
  284. .item{
  285. width: 100%;
  286. height: 100%;
  287. overflow-y: scroll;
  288. .search-wrap{
  289. margin-bottom: 24rpx;
  290. }
  291. }
  292. }
  293. .card-oper{
  294. position: absolute;
  295. width: 100%;
  296. bottom: 0;
  297. left:0;
  298. display: flex;
  299. flex-direction: row;
  300. justify-content: space-between;
  301. padding: 24rpx;
  302. .btn{
  303. width: 45%;
  304. }
  305. }
  306. }
  307. }
  308. /deep/ .u-popup__content{
  309. height: 55%;
  310. overflow-y: scroll;
  311. width: 100%;
  312. border-radius: 6px;
  313. }
  314. /deep/ .u-form-item__body__left{
  315. width: 80px !important;
  316. }
  317. </style>