returnedInfo.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394
  1. <template>
  2. <view>
  3. <view v-if="showData" class="container">
  4. <view style="padding: 20rpx 48rpx">
  5. <img src="https://soap.cliu.cc/chumeng/logo.png" class="logImg" alt="">
  6. <view v-if="form.status" class="container_title">
  7. <image src="../../static/CustomerReturnPay/w7.png" mode="widthFix" style="width: 100rpx; margin-right: 10rpx"></image>
  8. <text>已完成支付</text>
  9. </view>
  10. </view>
  11. <view class="boxList">
  12. <view v-for="(item, i) in list" :key="i">
  13. <view v-if="i != 0 && list.length > 1" class="image">
  14. <image src="../../static/CustomerReturnPay/line.png" style="width: 100%;" mode="widthFix" alt="">
  15. </view>
  16. <view class="box nav" :class="(i+1==1 && list.length==1) ? 'nav1' : (i+1==1 && list.length>1) ? 'nav3' : 'nav2'">
  17. <view class="box_item">
  18. <text class="textL">退货人:</text>
  19. <text class="textR">{{ item.customer_name }}</text>
  20. </view>
  21. <view class="box_item">
  22. <text class="textL">手机号:</text>
  23. <text class="textR">{{ item.customer_phone | hideMiddle }}</text>
  24. </view>
  25. <view class="box_line" />
  26. <view class="box_item">
  27. <text class="textL">所属公司客户:</text>
  28. <text class="textR">{{ item.user && item.user.nickname }}</text>
  29. </view>
  30. <view class="box_item">
  31. <text class="textL">手机号:</text>
  32. <text class="textR">{{ item.user && item.user.mobile | hideMiddle }}</text>
  33. </view>
  34. <view class="box_line" />
  35. <view class="box_item" v-for="(v,k) in item.goods">
  36. <text class="textL">{{ k }}</text>
  37. <text class="textR">{{ `${Object.values(v) + Object.keys(v)}` }}</text>
  38. </view>
  39. <view class="box_line" />
  40. <view class="box_item">
  41. <text class="textL">应退差价:</text>
  42. <text class="textR">{{ item.return_price }}</text>
  43. </view>
  44. <view class="box_item">
  45. <text class="textL">实退差价:</text>
  46. <text class="textR">{{ item.fact_money }}</text>
  47. </view>
  48. <view v-show="item.remark" class="box_item">
  49. <text class="textL">备注:</text>
  50. <text class="textR">{{ item.remark }}</text>
  51. </view>
  52. </view>
  53. </view>
  54. <view class="bottom">
  55. <view class="text">
  56. 差价总金额:
  57. </view>
  58. <view class="num">
  59. ¥{{ form.account }}
  60. </view>
  61. <view v-if="!form.status" class="pay" @click="toPay()">
  62. 下一步
  63. </view>
  64. </view>
  65. </view>
  66. </view>
  67. <view v-if="!showData && finish" class="finish">
  68. <image src="../../static/CustomerReturnPay/w3.png" mode="widthFix"></image>
  69. <text>{{ message }}</text>
  70. </view>
  71. <view v-if="!showData && !finish" class="notData">
  72. <image src="https://soap.cliu.cc/chumeng/no_record.png" mode="widthFix"></image>
  73. </view>
  74. </view>
  75. </template>
  76. <script>
  77. import { getRefundInfo, CustomerReturnPay } from '@/api/refundDifference.js';
  78. import { wxLogin } from '@/api/index.js'
  79. export default {
  80. data() {
  81. return {
  82. showData: false,
  83. form: {},
  84. list: [],
  85. data: {},
  86. finish: false,
  87. message: '',
  88. openid: '',
  89. id: '',
  90. verify: ''
  91. }
  92. },
  93. filters: {
  94. hideMiddle(val){ //隐藏号码
  95. if (val === null || !val) {
  96. return '';
  97. } else {
  98. return `${val.substring(0, 3)}****${val.substring(val.length - 4)}`;
  99. }
  100. }
  101. },
  102. onLoad(e) {
  103. // e = {
  104. // id: 542,
  105. // verify: 'lkjzhq'
  106. // }
  107. // 从登录页进入 或者扫二维码进入
  108. if (e.id && e.verify) {
  109. this.id = e.id
  110. this.verify = e.verify
  111. let wxcode = this.getUrlParam('code')
  112. // 回调进入
  113. if (!uni.getStorageSync('token') && wxcode) {
  114. this.getLogin(wxcode, e.id, e.verify)
  115. return
  116. }
  117. // 没有token, 去回调
  118. if (!uni.getStorageSync('token')) {
  119. this.toWxchatLogin(`/pages/CustomerReturnPay/returnedInfo?id=${e.id}&verify=${e.verify}`, null)
  120. return false;
  121. }
  122. this.getList()
  123. }
  124. },
  125. methods: {
  126. // 跳转微信授权
  127. toWxchatLogin(url, state) {
  128. url = url || '/pages/index/index';
  129. state = state || 'cli';
  130. const redirect_uri = encodeURIComponent(`${this.$config.redirect_uri}/#${url}`);
  131. const auth = () =>
  132. (window.location.href = `${this.$config.wxURL}?appid=${
  133. this.$config.appid
  134. }&redirect_uri=${redirect_uri}&response_type=code&scope=snsapi_userinfo&state=${state}#wechat_redirect`);
  135. auth();
  136. },
  137. // 登录
  138. getLogin(wxcode, id, verify) {
  139. wxLogin({ code: wxcode }).then(res => {
  140. let data = res.data
  141. if (data.token) {
  142. uni.setStorageSync('token', data.token)
  143. uni.setStorageSync('userInfo', data.user)
  144. this.getList()
  145. } else if (!data.token && data.openid) {
  146. uni.showModal({
  147. title: '提示',
  148. content: data.msg,
  149. showCancel: false,
  150. success: res => {
  151. uni.reLaunch({
  152. url: '../login/login?type=return' + '&openid=' + data.openid + '&id=' + id + '&verify=' + verify
  153. })
  154. }
  155. })
  156. } else if (!data.token && !data.openid) {
  157. uni.showModal({
  158. title: '错误提示',
  159. content: data.msg,
  160. showCancel: false
  161. })
  162. }
  163. })
  164. },
  165. //获取code值方法
  166. getUrlParam(name) {
  167. var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)'); //构造一个含有目标参数的正则表达式对象
  168. var r = window.location.search.substr(1).match(reg); //匹配目标参数
  169. if (r != null) return decodeURIComponent(r[2]);
  170. // return null; //返回参数值
  171. return ''; //返回参数值
  172. },
  173. // 解析链接中的参数
  174. getStyle(i, l) {
  175. const a = i + 1
  176. if (a == 1 && l == 1) {
  177. return 'nav1'
  178. } else if (a == 1 && l > 1) {
  179. return 'nav3'
  180. } else if (a == l && a != 1) {
  181. return 'nav2'
  182. }
  183. },
  184. getList() {
  185. getRefundInfo({ refund_id: this.id, verify: this.verify }).then(res => {
  186. if (res.code == 200) {
  187. if (res.data) {
  188. this.showData = true
  189. this.list = res.data.customer_return
  190. this.form = res.data
  191. }
  192. } else if (res.code == 450001) {
  193. this.finish = true
  194. this.message = res.message
  195. } else {
  196. uni.showModal({
  197. content: res.msg || '获取失败',
  198. showCancel: false
  199. })
  200. }
  201. }).catch(err => {
  202. })
  203. },
  204. toPay() {
  205. uni.navigateTo({
  206. url: './returnPay?id=' + this.id + '&amount=' + this.form.account
  207. })
  208. }
  209. }
  210. }
  211. </script>
  212. <style>
  213. page {
  214. background-size: 100% auto;
  215. background-repeat: repeat-y;
  216. background-image: url("https://soap.cliu.cc/chumeng/wall-min.png");
  217. }
  218. </style>
  219. <style lang="scss" scoped>
  220. .finish {
  221. display: flex;
  222. justify-content: center;
  223. flex-direction: column;
  224. align-items: center;
  225. color: #fff;
  226. padding-top: 50%;
  227. image {
  228. width: 100rpx;
  229. margin-bottom: 20rpx;
  230. }
  231. }
  232. .notData {
  233. display: flex;
  234. justify-content: center;
  235. flex-direction: column;
  236. align-items: center;
  237. background-color: #fff;
  238. color: #fff;
  239. height: 100vh;
  240. image {
  241. width: 500rpx;
  242. }
  243. }
  244. .container {
  245. width: 100vw;
  246. // height: 100%;
  247. padding-top: 40rpx !important;
  248. padding-bottom: 140rpx;
  249. &_title {
  250. display:flex;
  251. color: #fff;
  252. align-items: center;
  253. justify-content: center;
  254. text {
  255. font-size: 40rpx;
  256. font-weight: bold;
  257. }
  258. }
  259. .logImg {
  260. width: 588rpx;
  261. height: 94rpx;
  262. display: block;
  263. margin: 0 auto;
  264. }
  265. .nav1 {
  266. border-radius: 16rpx;
  267. }
  268. .nav2 {
  269. border-radius: 0 0 16rpx 16rpx !important;
  270. }
  271. .nav3 {
  272. border-radius: 16rpx 16rpx 0 0 !important;
  273. }
  274. .boxList {
  275. padding: 0 24rpx;
  276. }
  277. .box {
  278. margin-top: -1rpx;
  279. padding: 24rpx 24rpx 0 24rpx;
  280. background: #FFFFFF;
  281. // border-radius: 16rpx;
  282. &_item {
  283. display: flex;
  284. justify-content: space-between;
  285. text {
  286. font-size: 32rpx;
  287. margin-bottom: 24rpx;
  288. display: block;
  289. }
  290. .textL {
  291. color: #999999;
  292. }
  293. .textR {
  294. color: #333333;
  295. width: 360rpx;
  296. text-align: end;
  297. word-break: break-all;
  298. }
  299. }
  300. &_line {
  301. border-bottom: 2rpx solid #EEEEEE;
  302. margin-bottom: 24rpx;
  303. }
  304. }
  305. .image {
  306. box-sizing: border-box;
  307. display: flex;
  308. flex-direction: column;
  309. }
  310. .bottom {
  311. position: fixed;
  312. height: 112rpx;
  313. left: 0;
  314. bottom: 0;
  315. width: 100%;
  316. border-top: 2rpx solid #EEEEEE;
  317. background-color: #fff;
  318. display: flex;
  319. justify-content: flex-end;
  320. align-items: center;
  321. .pay {
  322. width: 30%;
  323. line-height: 80rpx;
  324. text-align: center;
  325. margin-right: 20rpx;
  326. background: linear-gradient(91deg, #F30000 0%, #FE4815 100%);
  327. border-radius: 44rpx 44rpx 44rpx 44rpx;
  328. font-size: 32rpx;
  329. font-weight: bold;
  330. color: #FFFFFF;
  331. }
  332. .text {
  333. font-size: 26rpx;
  334. color: #333333;
  335. }
  336. .num {
  337. font-size: 34rpx;
  338. color: #FB231F;
  339. font-weight: bold;
  340. margin-right: 20rpx;
  341. }
  342. }
  343. // .bottom {
  344. // position: fixed;
  345. // left: 0;
  346. // bottom: 0;
  347. // width: 100%;
  348. // background-size: 100% auto;
  349. // background-repeat: repeat-y;
  350. // background-image: url("../../static/img/wall-min.png");
  351. // .btn {
  352. // padding: 20rpx 24rpx;
  353. // background-color: #fff;
  354. // display: flex;
  355. // justify-content: center;
  356. // align-items: center;
  357. // .pay {
  358. // width: 100%;
  359. // line-height: 88rpx;
  360. // text-align: center;
  361. // background: linear-gradient(91deg, #F30000 0%, #FE4815 100%);
  362. // border-radius: 44rpx 44rpx 44rpx 44rpx;
  363. // font-size: 32rpx;
  364. // font-weight: bold;
  365. // color: #FFFFFF;
  366. // }
  367. // }
  368. // .totalMoney {
  369. // padding: 86rpx 0 82rpx 0;
  370. // margin: 24rpx 24rpx 40rpx 24rpx;
  371. // border-radius: 16rpx 16rpx 16rpx 16rpx;
  372. // background-color: #fff;
  373. // display: flex;
  374. // flex-direction: column;
  375. // align-items: center;
  376. // font-weight: bold;
  377. // &_text {
  378. // font-size: 36rpx;
  379. // margin-bottom: 24rpx;
  380. // color: #333333;
  381. // }
  382. // &_num {
  383. // font-size: 76rpx;
  384. // color: #FB231F;
  385. // }
  386. // }
  387. // }
  388. }
  389. </style>