Orderdetails.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438
  1. <template>
  2. <view class="billall">
  3. <view class="top">
  4. <view class="title">总费用</view>
  5. <view class="money">{{alldata.payAmount}}</view>
  6. </view>
  7. <view class="detailContent">
  8. <view class="mb8">当前状态:{{alldata.status}}</view>
  9. <view class="mb8">账单时间:{{alldata.createDate}}</view>
  10. <view class="mingxi">
  11. <text>账单明细:</text>
  12. <view>
  13. <view v-for="(item, index) in indexList" :key="index" class="mb4">
  14. {{item.costType}}:¥{{item.amount}}
  15. </view>
  16. </view>
  17. </view>
  18. </view>
  19. <view class="dibu" v-show="dibucaidan">
  20. <view class="yucun" v-if='tk'>
  21. <u-button type="error" text="退费" @click="prestore('退费')"></u-button>
  22. </view>
  23. </view>
  24. <u-popup :show="showpayjine" @close="closepay1" @open="openpay1" mode="bottom" :round="10" :closeable='true' :closeOnClickOverlay='false'>
  25. <view class="paytall1">
  26. <!-- <text>请选择支付方式</text> -->
  27. <view class="hejitop">
  28. 退费
  29. </view>
  30. <view class="zhifufs">
  31. <u--form labelWidth="130" labelPosition="left" :model="model1" ref="uForm">
  32. <u-form-item label="退费金额:" prop="userInfo.amount" borderBottom ref="item1">
  33. <u--input v-model="model1.userInfo.amount" border="none"></u--input>
  34. </u-form-item>
  35. <u-form-item label="退费原因:" prop="userInfo.refundReason" borderBottom ref="item1">
  36. <u--input v-model="model1.userInfo.refundReason" border="none"></u--input>
  37. </u-form-item>
  38. </u--form>
  39. </view>
  40. <view class="dcc">
  41. <view class="">
  42. <u-button type="primary" :plain="true" text="取消" @click="closepay1"></u-button>
  43. </view>
  44. <view class="">
  45. <u-button type="primary" text="确定" @click="confirmtf"></u-button>
  46. </view>
  47. </view>
  48. </view>
  49. </u-popup>
  50. <u-notify ref="uNotify" message=""></u-notify>
  51. </view>
  52. </template>
  53. <script>
  54. export default {
  55. data() {
  56. return {
  57. tk:false,
  58. zhifucanvas: false,
  59. dibucaidan: true,
  60. prestorename: '',
  61. totalnumber: 0,
  62. setyesno: true,
  63. indexList: [],
  64. dataList: [],
  65. showtype: false,
  66. showdct: false,
  67. myid: '',
  68. alldata: {},
  69. showfloor: false,
  70. loading: false,
  71. columns: [],
  72. columnData: [],
  73. myday: '',
  74. mytype: '全部',
  75. showPicker: false,
  76. //myday: currentDate,
  77. showpayjine: false,
  78. PropertyTypedata:[],
  79. model1: {
  80. userInfo: {
  81. amount: '',
  82. refundReason:'',
  83. },
  84. },
  85. billstype:[],
  86. // rules: {
  87. // 'userInfo.amount': {
  88. // type: 'string',
  89. // required: true,
  90. // message: '请填写退费金额',
  91. // trigger: [ '']
  92. // },
  93. // 'userInfo.refundReason': {
  94. // type: 'string',
  95. // required: true,
  96. // message: '请填写退费原因',
  97. // trigger: ['blur', 'change']
  98. // },
  99. // },
  100. }
  101. },
  102. //监听页面加载,其参数为上个页面传递的数据,参数类型为 Object(用于页面传参
  103. onLoad(options) {
  104. this.myid = options.companyOrgId;
  105. this.getalldata(this.myid)
  106. let getDictDataList = uni.getStorageSync('getDictDataList');
  107. for (let i = 0; i < getDictDataList.length; i++) {
  108. if (getDictDataList[i].dictType == 'PayType') {
  109. this.billstype = getDictDataList[i].dataList
  110. }
  111. if (getDictDataList[i].dictType == 'PropertyType') {
  112. this.PropertyTypedata = getDictDataList[i].dataList
  113. }
  114. }
  115. },
  116. //监听页面初次渲染完成。注意如果渲染速度快,会在页面进入动画完成前触发
  117. onReady() {
  118. // 微信小程序需要用此写法
  119. },
  120. //监听页面隐藏
  121. onHide() {},
  122. //监听窗口尺寸变化
  123. onResize() {},
  124. //监听页面卸载
  125. onUnload() {},
  126. //监听用户下拉动作,一般用于下拉刷新
  127. onPullDownRefresh() {},
  128. methods: {
  129. prestore() {
  130. this.showpayjine = true;
  131. },
  132. confirmtf() {
  133. if(this.model1.userInfo.amount==''){
  134. this.$refs.uNotify.error('退款金额不能为空')
  135. }else if(this.model1.userInfo.refundReason==''){
  136. this.$refs.uNotify.error('退款原因不能为空')
  137. }else{
  138. if(this.model1.userInfo.amount>this.alldata.payAmount){
  139. this.$refs.uNotify.error('您输入的退款金额不能大于支付金额')
  140. }else{
  141. let postdata = {
  142. amount: this.model1.userInfo.amount,
  143. id: '',
  144. orderId:this.alldata.id,
  145. refundReason: this.model1.userInfo.refundReason
  146. }
  147. this.$api.post('/refundinfo', postdata)
  148. .then(res => {
  149. if (res.data.code == 0) {
  150. this.$refs.uNotify.success('退费申请成功')
  151. } else {
  152. this.$refs.uNotify.error(res.data.msg)
  153. }
  154. this.showpayjine = false;
  155. })
  156. }
  157. }
  158. },
  159. getalldata(e) {
  160. this.indexList=[];
  161. this.$api.get('/order/' + e, {})
  162. .then(res => {
  163. console.log('111111111111111111', res.data.data)
  164. if (res.data.data.status == '-1') {
  165. res.data.data.status = '已关闭';
  166. this.tk=false;
  167. } else if (res.data.data.status == '0') {
  168. res.data.data.status = '待支付';
  169. this.tk=false;
  170. } else if (res.data.data.status == '1') {
  171. res.data.data.status = '已支付';
  172. this.tk=true;
  173. }
  174. this.alldata = res.data.data;
  175. this.model1.userInfo.amount=this.alldata.payAmount;
  176. //this.$refs.uForm.validateField('userInfo.amount')
  177. //this.indexList = res.data.data.billLists;
  178. if(res.data.data.billLists.length==0){
  179. this.indexList=[];
  180. }else{
  181. function transform(a, b) {
  182. loop: for (let i = 0; i < a.length; i++) {
  183. for (let j = 0; j < b.length; j++) {
  184. if (a[i].billType == b[j].dictValue) {
  185. a[i].billType = b[j].dictLabel;
  186. continue loop;
  187. }
  188. }
  189. a[i].billType = a[i].billType;
  190. }
  191. return a;
  192. }
  193. function transform1(a, b) {
  194. loop: for (let i = 0; i < a.length; i++) {
  195. for (let j = 0; j < b.length; j++) {
  196. if (a[i].costType == b[j].dictValue) {
  197. a[i].costType = b[j].dictLabel;
  198. continue loop;
  199. }
  200. }
  201. a[i].costType = a[i].costType;
  202. }
  203. return a;
  204. }
  205. this.indexList=transform(res.data.data.billLists, this.billstype) ;
  206. this.indexList=transform1(res.data.data.billLists, this.PropertyTypedata) ;
  207. }
  208. console.log('111111111111111111',this.indexList)
  209. })
  210. },
  211. closepay1() {
  212. this.showpayjine = false;
  213. },
  214. openpay1() {
  215. console.log('open');
  216. },
  217. }
  218. }
  219. </script>
  220. <style lang="scss">
  221. .Currentamount {
  222. padding-left: 30rpx;
  223. height: 50rpx;
  224. line-height: 50rpx;
  225. color: #BCB3A7;
  226. span {
  227. color: #FA5555;
  228. padding-left: 9rpx;
  229. }
  230. }
  231. .hejitop {
  232. width: 750rpx;
  233. text-align: center;
  234. font-weight: bold;
  235. font-size: 40rpx;
  236. margin-bottom: 30rpx;
  237. }
  238. .zhifufs {
  239. width: 750rpx;
  240. height: 250rpx;
  241. }
  242. .paytall1 {
  243. width: 750rpx;
  244. height: 450rpx;
  245. background-color: #fff;
  246. }
  247. .dcc {
  248. margin: 0 30rpx;
  249. display: flex;
  250. align-items: center;
  251. justify-content: space-around;
  252. view {
  253. width: 200rpx;
  254. }
  255. }
  256. .tuifeiyy {
  257. height: 400rpx;
  258. background-color: #fff;
  259. width: 750rpx;
  260. }
  261. .Orderstatus {
  262. padding: 30rpx;
  263. }
  264. .Orderstatus1 {
  265. height: 50rpx;
  266. line-height: 50rpx;
  267. }
  268. .Callfee {
  269. width: 100rpx;
  270. height: 45rpx;
  271. text-align: center;
  272. line-height: 45rpx;
  273. color: #5C8FFF;
  274. border: 1px solid #5C8FFF;
  275. font-size: 22rpx;
  276. position: absolute;
  277. bottom: 10rpx;
  278. right: 10px;
  279. font-weight: bold;
  280. }
  281. .companylist {
  282. margin: 20rpx 30rpx;
  283. background: #fff;
  284. height: 230rpx;
  285. border-radius: 10px;
  286. position: relative;
  287. h3 {
  288. height: 70rpx;
  289. line-height: 70rpx;
  290. padding-left: 30rpx;
  291. }
  292. }
  293. .settled {
  294. background-color: #09C700;
  295. width: 100rpx;
  296. height: 40rpx;
  297. text-align: center;
  298. line-height: 40rpx;
  299. color: #fff;
  300. font-size: 14rpx;
  301. position: absolute;
  302. top: 0px;
  303. right: 0px;
  304. border-top-right-radius: 10rpx;
  305. border-bottom-left-radius: 10rpx;
  306. }
  307. .outstanding {
  308. background-color: #30D3A2;
  309. width: 100rpx;
  310. height: 40rpx;
  311. text-align: center;
  312. line-height: 40rpx;
  313. color: #fff;
  314. font-size: 14rpx;
  315. position: absolute;
  316. top: 0px;
  317. right: 0px;
  318. border-top-right-radius: 10rpx;
  319. border-bottom-left-radius: 10rpx;
  320. }
  321. .guanbi {
  322. background-color: red;
  323. width: 100rpx;
  324. height: 40rpx;
  325. text-align: center;
  326. line-height: 40rpx;
  327. color: #fff;
  328. font-size: 14rpx;
  329. position: absolute;
  330. top: 0px;
  331. right: 0px;
  332. border-top-right-radius: 10rpx;
  333. border-bottom-left-radius: 10rpx;
  334. }
  335. .dibu {
  336. position: fixed;
  337. right: 0;
  338. left: 0;
  339. bottom: 0;
  340. width: 750rpx;
  341. height: 100rpx;
  342. display: flex;
  343. align-items: center;
  344. justify-content: space-around;
  345. background-color: #fff;
  346. }
  347. .yucun {
  348. width: 200rpx;
  349. }
  350. .billall {
  351. padding: 40rpx 80rpx;
  352. background-color: #fff;
  353. .top{
  354. text-align: center;
  355. border-bottom: 1px solid #eee;
  356. color: #0C1935;
  357. .title{
  358. font-size: 32rpx;
  359. }
  360. .money{
  361. font-size: 48rpx;
  362. margin: 24rpx 0 40rpx;
  363. font-weight: 600;
  364. }
  365. }
  366. .detailContent{
  367. color: #9DA0AC;
  368. padding-top: 16rpx;
  369. .mingxi{
  370. display: flex;
  371. }
  372. .mb8{margin-bottom: 16rpx;}
  373. .mb4{margin-bottom: 8rpx;}
  374. }
  375. }
  376. .topbill {
  377. display: flex;
  378. justify-content: center;
  379. align-items: center;
  380. height: 100rpx;
  381. background-color: #e6e6e6;
  382. }
  383. .topbilledit {
  384. display: flex;
  385. justify-content: space-around;
  386. align-items: center;
  387. }
  388. .changetime1 {
  389. padding-right: 10rpx;
  390. }
  391. </style>