Orderdetails.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444
  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. // console.log(options.companyOrgId);
  105. this.myid = options.companyOrgId;
  106. this.getalldata(this.myid)
  107. let getDictDataList = uni.getStorageSync('getDictDataList');
  108. console.log('111111111111111111', getDictDataList)
  109. for (let i = 0; i < getDictDataList.length; i++) {
  110. if (getDictDataList[i].dictType == 'PayType') {
  111. this.billstype = getDictDataList[i].dataList
  112. }
  113. if (getDictDataList[i].dictType == 'PropertyType') {
  114. this.PropertyTypedata = getDictDataList[i].dataList
  115. }
  116. }
  117. },
  118. //监听页面初次渲染完成。注意如果渲染速度快,会在页面进入动画完成前触发
  119. onReady() {
  120. // 微信小程序需要用此写法
  121. },
  122. //监听页面隐藏
  123. onHide() {},
  124. //监听窗口尺寸变化
  125. onResize() {},
  126. //监听页面卸载
  127. onUnload() {},
  128. //监听用户下拉动作,一般用于下拉刷新
  129. onPullDownRefresh() {},
  130. methods: {
  131. prestore() {
  132. this.showpayjine = true;
  133. },
  134. confirmtf() {
  135. if(this.model1.userInfo.amount==''){
  136. this.$refs.uNotify.error('退款金额不能为空')
  137. }else if(this.model1.userInfo.refundReason==''){
  138. this.$refs.uNotify.error('退款原因不能为空')
  139. }else{
  140. if(this.model1.userInfo.amount>this.alldata.payAmount){
  141. this.$refs.uNotify.error('您输入的退款金额不能大于支付金额')
  142. }else{
  143. let postdata = {
  144. amount: this.model1.userInfo.amount,
  145. id: '',
  146. orderId:this.alldata.id,
  147. refundReason: this.model1.userInfo.refundReason
  148. }
  149. this.$api.post('/refundinfo', postdata)
  150. .then(res => {
  151. if (res.data.code == 0) {
  152. this.$refs.uNotify.success('退费申请成功')
  153. } else {
  154. this.$refs.uNotify.error(res.data.msg)
  155. }
  156. this.showpayjine = false;
  157. })
  158. }
  159. }
  160. },
  161. getalldata(e) {
  162. this.indexList=[];
  163. this.$api.get('/order/' + e, {})
  164. .then(res => {
  165. console.log('111111111111111111', res.data.data)
  166. if (res.data.data.status == '-1') {
  167. res.data.data.status = '已关闭';
  168. this.tk=false;
  169. } else if (res.data.data.status == '0') {
  170. res.data.data.status = '待支付';
  171. this.tk=false;
  172. } else if (res.data.data.status == '1') {
  173. res.data.data.status = '已支付';
  174. this.tk=true;
  175. }
  176. this.alldata = res.data.data;
  177. this.model1.userInfo.amount=this.alldata.payAmount;
  178. //this.$refs.uForm.validateField('userInfo.amount')
  179. //this.indexList = res.data.data.billLists;
  180. if(res.data.data.billLists.length==0){
  181. this.indexList=[];
  182. }else{
  183. function transform(a, b) {
  184. loop: for (let i = 0; i < a.length; i++) {
  185. for (let j = 0; j < b.length; j++) {
  186. if (a[i].billType == b[j].dictValue) {
  187. a[i].billType = b[j].dictLabel;
  188. continue loop;
  189. }
  190. }
  191. a[i].billType = a[i].billType;
  192. }
  193. return a;
  194. }
  195. function transform1(a, b) {
  196. loop: for (let i = 0; i < a.length; i++) {
  197. for (let j = 0; j < b.length; j++) {
  198. if (a[i].costType == b[j].dictValue) {
  199. a[i].costType = b[j].dictLabel;
  200. continue loop;
  201. }
  202. }
  203. a[i].costType = a[i].costType;
  204. }
  205. return a;
  206. }
  207. this.indexList=transform(res.data.data.billLists, this.billstype) ;
  208. this.indexList=transform1(res.data.data.billLists, this.PropertyTypedata) ;
  209. }
  210. console.log('111111111111111111',this.indexList)
  211. })
  212. },
  213. closepay1() {
  214. this.showpayjine = false;
  215. },
  216. openpay1() {
  217. console.log('open');
  218. },
  219. }
  220. }
  221. </script>
  222. <style lang="scss">
  223. .Currentamount {
  224. padding-left: 30rpx;
  225. height: 50rpx;
  226. line-height: 50rpx;
  227. color: #BCB3A7;
  228. span {
  229. color: #FA5555;
  230. padding-left: 9rpx;
  231. }
  232. }
  233. .hejitop {
  234. width: 750rpx;
  235. text-align: center;
  236. font-weight: bold;
  237. font-size: 40rpx;
  238. margin-bottom: 30rpx;
  239. }
  240. .zhifufs {
  241. width: 750rpx;
  242. height: 250rpx;
  243. }
  244. .paytall1 {
  245. width: 750rpx;
  246. height: 450rpx;
  247. background-color: #fff;
  248. }
  249. .dcc {
  250. margin: 0 30rpx;
  251. display: flex;
  252. align-items: center;
  253. justify-content: space-around;
  254. view {
  255. width: 200rpx;
  256. }
  257. }
  258. .tuifeiyy {
  259. height: 400rpx;
  260. background-color: #fff;
  261. width: 750rpx;
  262. }
  263. .Orderstatus {
  264. padding: 30rpx;
  265. }
  266. .Orderstatus1 {
  267. height: 50rpx;
  268. line-height: 50rpx;
  269. }
  270. .Callfee {
  271. width: 100rpx;
  272. height: 45rpx;
  273. text-align: center;
  274. line-height: 45rpx;
  275. color: #5C8FFF;
  276. border: 1px solid #5C8FFF;
  277. font-size: 22rpx;
  278. position: absolute;
  279. bottom: 10rpx;
  280. right: 10px;
  281. font-weight: bold;
  282. }
  283. .companylist {
  284. margin: 20rpx 30rpx;
  285. background: #fff;
  286. height: 230rpx;
  287. border-radius: 10px;
  288. position: relative;
  289. h3 {
  290. height: 70rpx;
  291. line-height: 70rpx;
  292. padding-left: 30rpx;
  293. }
  294. }
  295. .settled {
  296. background-color: #09C700;
  297. width: 100rpx;
  298. height: 40rpx;
  299. text-align: center;
  300. line-height: 40rpx;
  301. color: #fff;
  302. font-size: 14rpx;
  303. position: absolute;
  304. top: 0px;
  305. right: 0px;
  306. border-top-right-radius: 10rpx;
  307. border-bottom-left-radius: 10rpx;
  308. }
  309. .outstanding {
  310. background-color: #30D3A2;
  311. width: 100rpx;
  312. height: 40rpx;
  313. text-align: center;
  314. line-height: 40rpx;
  315. color: #fff;
  316. font-size: 14rpx;
  317. position: absolute;
  318. top: 0px;
  319. right: 0px;
  320. border-top-right-radius: 10rpx;
  321. border-bottom-left-radius: 10rpx;
  322. }
  323. .guanbi {
  324. background-color: red;
  325. width: 100rpx;
  326. height: 40rpx;
  327. text-align: center;
  328. line-height: 40rpx;
  329. color: #fff;
  330. font-size: 14rpx;
  331. position: absolute;
  332. top: 0px;
  333. right: 0px;
  334. border-top-right-radius: 10rpx;
  335. border-bottom-left-radius: 10rpx;
  336. }
  337. .dibu {
  338. position: fixed;
  339. right: 0;
  340. left: 0;
  341. bottom: 0;
  342. width: 750rpx;
  343. height: 100rpx;
  344. display: flex;
  345. align-items: center;
  346. justify-content: space-around;
  347. background-color: #fff;
  348. }
  349. .yucun {
  350. width: 200rpx;
  351. }
  352. .billall {
  353. padding: 40rpx 80rpx;
  354. background-color: #fff;
  355. .top{
  356. text-align: center;
  357. border-bottom: 1px solid #eee;
  358. color: #0C1935;
  359. .title{
  360. font-size: 32rpx;
  361. }
  362. .money{
  363. font-size: 48rpx;
  364. margin: 24rpx 0 40rpx;
  365. font-weight: 600;
  366. }
  367. }
  368. .detailContent{
  369. color: #9DA0AC;
  370. padding-top: 16rpx;
  371. .mingxi{
  372. display: flex;
  373. }
  374. .mb8{margin-bottom: 16rpx;}
  375. .mb4{margin-bottom: 8rpx;}
  376. }
  377. }
  378. .topbill {
  379. display: flex;
  380. justify-content: center;
  381. align-items: center;
  382. height: 100rpx;
  383. background-color: #e6e6e6;
  384. }
  385. .topbilledit {
  386. display: flex;
  387. justify-content: space-around;
  388. align-items: center;
  389. }
  390. .changetime1 {
  391. padding-right: 10rpx;
  392. }
  393. </style>