酒店桌布为微信小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

468 lines
10 KiB

9 months ago
8 months ago
9 months ago
8 months ago
8 months ago
9 months ago
8 months ago
9 months ago
8 months ago
8 months ago
9 months ago
8 months ago
9 months ago
8 months ago
9 months ago
8 months ago
9 months ago
8 months ago
9 months ago
8 months ago
9 months ago
8 months ago
9 months ago
8 months ago
9 months ago
8 months ago
9 months ago
8 months ago
9 months ago
8 months ago
9 months ago
9 months ago
8 months ago
9 months ago
8 months ago
9 months ago
8 months ago
9 months ago
8 months ago
8 months ago
9 months ago
8 months ago
9 months ago
8 months ago
8 months ago
9 months ago
8 months ago
9 months ago
8 months ago
9 months ago
8 months ago
9 months ago
8 months ago
8 months ago
8 months ago
8 months ago
9 months ago
9 months ago
9 months ago
8 months ago
9 months ago
8 months ago
9 months ago
8 months ago
9 months ago
8 months ago
9 months ago
8 months ago
9 months ago
8 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
  1. <template>
  2. <view class="refundsOrExchange">
  3. <navbar :title="title[titleIndex]" leftClick @leftClick="$utils.navigateBack" />
  4. <view class="frame">
  5. <!-- 商品简介 -->
  6. <view class="itme1" @click="openSpPopup">
  7. <view class="left">
  8. <image :src="commodity.goodsPic" mode="aspectFill" />
  9. </view>
  10. <view class="center">
  11. <view>{{ commodity.goodsName }}</view>
  12. <view v-if="commodity.sku">商品规格:{{ commodity.sku }}</view>
  13. <view v-if="commodity.createTime">下单时间:{{ $dayjs(commodity.createTime).format('YYYY-MM-DD') }}</view>
  14. </view>
  15. <view class="right" v-if="commodity.num">×{{ commodity.num }}</view>
  16. </view>
  17. <!-- 暂未选择商品的时候 -->
  18. <!-- <view v-else style="height: 200rpx;;display: flex;justify-content: center;align-items: center;font-size: 36px;">
  19. 请选择商品...
  20. </view> -->
  21. <!-- 地址 -->
  22. <view class="address" @click="openAddress">
  23. <image src="/static/image/address/selectIcon.png" mode=""></image>
  24. <view class="">
  25. {{ address.name }}
  26. </view>
  27. <view class="">
  28. {{ address.addressDetail }}
  29. </view>
  30. <view class="icon">
  31. <uv-icon size="30rpx" name="arrow-right"></uv-icon>
  32. </view>
  33. </view>
  34. <!-- 申请类型&申请原因 -->
  35. <view class="item2">
  36. <view class="type">
  37. <span>申请类型</span>
  38. <span>{{ titleIndex == 0?'退货退款':'换货'}}</span>
  39. </view>
  40. <uv-line></uv-line>
  41. <view class="reason">
  42. <view>申请原因</view>
  43. <view>
  44. <uv-input v-model="form.reason" placeholder="请输入申请原因" border="none" clearable></uv-input>
  45. </view>
  46. </view>
  47. </view>
  48. <!-- 退货数量&申请金额-->
  49. <view class="item3">
  50. <view class="type">
  51. <span>{{ titleIndex == 0 ? '退货数量' : '换货数量' }}</span>
  52. <span>
  53. <uv-number-box v-model="form.refundNum" :min="1" :max="commodity.num"></uv-number-box>
  54. </span>
  55. </view>
  56. <uv-line v-if='titleIndex == 0 ? true :false'></uv-line>
  57. <view class="reason" v-if='titleIndex == 0 ? true :false'>
  58. <view>申请金额</view>
  59. <view>
  60. <uv-input v-model="form.reasonPrice" disabled border="none" clearable></uv-input>
  61. </view>
  62. </view>
  63. </view>
  64. <!-- 申请说明 -->
  65. <view class="item4">
  66. <view>申请说明(选填)</view>
  67. <view>
  68. <uv-input v-model="form.reasonInfo" placeholder="请您详细填写申请说明" border="none" clearable></uv-input>
  69. </view>
  70. <view>
  71. <uv-upload :fileList="fileList" :maxCount="5" multiple width="150rpx" height="150rpx"
  72. @delete="deleteImage" @afterRead="afterRead" :previewFullImage="true"></uv-upload>
  73. </view>
  74. </view>
  75. <!-- 联系电话 -->
  76. <!-- <view class="item5">
  77. <view class="phone">
  78. <view>联系电话</view>
  79. <view>
  80. <uv-input v-model="form.phone" placeholder="请输入联系电话" border="none" clearable></uv-input>
  81. </view>
  82. </view>
  83. </view> -->
  84. </view>
  85. <!-- 底部按钮 -->
  86. <bottomBtn @confirm='confirm()' :color='bottomBtnStyle.color' :backgroundColor='bottomBtnStyle.backgroundColor'
  87. :fontSize='bottomBtnStyle.fontSize' :text='bottomBtnStyle.text' :width="bottomBtnStyle.width"
  88. :height="bottomBtnStyle.height" :borderRadius='bottomBtnStyle.borderRadius' :bottom='bottomBtnStyle.bottom'>
  89. </bottomBtn>
  90. <!--商品选择-->
  91. <uv-popup ref="spPopup" :round="30">
  92. <commoditySelect height="60vh" leaseFlag="1" status="0" @selectSp="selectCommodity" ref="commoditySelect" />
  93. </uv-popup>
  94. <uv-popup ref="addressPopup" :round="30">
  95. <addressList ref="addressList" height="60vh" @select="selectAddress" />
  96. </uv-popup>
  97. </view>
  98. </template>
  99. <script>
  100. import bottomBtn from "../../components/bottom/bottomBtn.vue"
  101. import commoditySelect from "../components/commodity/commoditySelect.vue"
  102. import addressList from '@/components/address/addressList.vue'
  103. export default {
  104. onLoad(option) {
  105. this.titleIndex = option.index
  106. },
  107. components: {
  108. bottomBtn,
  109. addressList,
  110. commoditySelect
  111. },
  112. data() {
  113. return {
  114. titleIndex: 0,
  115. title: ['申请退货', '申请换货'],
  116. fileList: [],
  117. bottomBtnStyle: {
  118. color: '#FFF',
  119. backgroundColor: '#fd5100',
  120. fontSize: '34rpx',
  121. text: '提交申请',
  122. width: '400rpx',
  123. height: '80rpx',
  124. borderRadius: '100rpx',
  125. bottom: '40rpx'
  126. },
  127. commodity: {
  128. goodsName: '请选择租赁物品',
  129. sku: '',
  130. num: 0,
  131. startTime: '',
  132. goodsPic: '',
  133. },
  134. form: {
  135. id: "",
  136. phone: "",
  137. reason: "",
  138. reasonInfo: "",
  139. reasonPic: "",
  140. reasonPrice: "",
  141. refundNum: "",
  142. type: '', //0退货 1换货
  143. },
  144. addressTotal: 0,
  145. address: {
  146. name: '请选择联系人',
  147. addressDetail: '',
  148. },
  149. }
  150. },
  151. onShow() {
  152. this.$refs.commoditySelect.getList()
  153. // 获取地址列表
  154. this.$refs.addressList.getAddressList().then(res => {
  155. this.addressTotal = res.total
  156. if (this.addressTotal != 0) {
  157. this.address = res.records[0]
  158. }
  159. })
  160. },
  161. methods: {
  162. openSpPopup() {
  163. this.$refs.spPopup.open('bottom');
  164. },
  165. // 打开选择地址
  166. openAddress() {
  167. if (this.addressTotal == 0) {
  168. this.$refs.popup.close()
  169. return uni.navigateTo({
  170. url: '/pages_order/mine/address?type=back'
  171. })
  172. }
  173. this.$refs.addressPopup.open('bottom')
  174. },
  175. // 选择地址
  176. selectAddress(e) {
  177. this.address = e
  178. this.$refs.addressPopup.close()
  179. },
  180. // 选择退换货商品回调
  181. selectCommodity(e) {
  182. console.log(e, "selectCommodity--e")
  183. console.log(e.id, 'e.id');
  184. this.form.id = e.id //设置租赁ID
  185. this.form.reasonPrice = e.price //设置退款金额(押金)
  186. this.form.refundNum = e.num //设置数量
  187. this.commodity = e
  188. this.$refs.spPopup.close()
  189. },
  190. //确认退换货
  191. confirm() {
  192. this.form.type = this.titleIndex
  193. this.form.reasonPic = this.fileList.map(item=>item.url).join(",")
  194. this.form.addressId = this.address.id
  195. if (this.$utils.verificationAll(this.form, {
  196. id: '请选择租赁物品',
  197. reason: '请输入申请原因',
  198. addressId: '请选择地址',
  199. })) {
  200. return
  201. }
  202. this.$api('refundOrder', this.form, res => {
  203. if (res.code == 200) {
  204. uni.showToast({
  205. icon: "success",
  206. title: "申请成功"
  207. })
  208. setTimeout(() => {
  209. uni.navigateTo({
  210. url: '/pages/index/center'
  211. })
  212. }, 3000)
  213. }
  214. })
  215. },
  216. deleteImage(e) {
  217. this.fileList.splice(e.index, 1)
  218. },
  219. afterRead(e) {
  220. let self = this
  221. e.file.forEach(file => {
  222. self.$Oss.ossUpload(file.url).then(url => {
  223. self.fileList.push({
  224. url
  225. })
  226. })
  227. })
  228. },
  229. }
  230. }
  231. </script>
  232. <style lang="scss" scoped>
  233. * {
  234. box-sizing: border-box;
  235. }
  236. .refundsOrExchange {
  237. .address {
  238. display: flex;
  239. padding: 20rpx;
  240. background-color: #fff;
  241. image {
  242. width: 30rpx;
  243. height: 30rpx;
  244. margin: 20rpx;
  245. }
  246. view {
  247. margin: 20rpx;
  248. overflow: hidden; //超出的文本隐藏
  249. text-overflow: ellipsis; //溢出用省略号显示
  250. white-space: nowrap; //溢出不换行
  251. }
  252. .icon {
  253. margin-left: auto;
  254. }
  255. }
  256. .frame {
  257. display: flex;
  258. flex-direction: column;
  259. gap: 30rpx;
  260. // width: 100%;
  261. padding: 40rpx 40rpx 0 40rpx;
  262. background-color: #f5f5f5;
  263. .itme1 {
  264. display: flex;
  265. height: 200rpx;
  266. background-color: #ffffff;
  267. .left {
  268. padding: 20rpx;
  269. width: 150rpx;
  270. height: 150rpx;
  271. border-radius: 20rpx;
  272. background-color: #ffffff;
  273. flex-shrink: 0;
  274. image {
  275. width: 100%;
  276. height: 100%;
  277. border-radius: 20rpx;
  278. }
  279. }
  280. .center {
  281. display: flex;
  282. flex-direction: column;
  283. justify-content: center;
  284. gap: 20rpx;
  285. width: 60%;
  286. padding: 0rpx 0 0 20rpx;
  287. background-color: #ffffff;
  288. // 给第一个 view 设置样式
  289. >view:first-of-type {
  290. font-size: 36rpx;
  291. color: #333;
  292. }
  293. // 给第二个 view 设置样式
  294. >view:nth-of-type(2) {
  295. font-size: 28rpx;
  296. color: #666666;
  297. }
  298. // 给第三个 view 设置样式
  299. >view:nth-of-type(3) {
  300. font-size: 28rpx;
  301. color: #666666;
  302. }
  303. }
  304. .right {
  305. display: flex;
  306. justify-content: center;
  307. align-items: center;
  308. width: 10%;
  309. color: #666666;
  310. background-color: #ffffff;
  311. }
  312. }
  313. .item2 {
  314. // width: 100vw;
  315. .type {
  316. display: flex;
  317. align-items: center;
  318. background-color: #FFF;
  319. height: 80rpx;
  320. padding: 0 0 0 20rpx;
  321. >span:nth-of-type(1) {
  322. width: 30%;
  323. }
  324. >span:nth-of-type(2) {
  325. width: 70%;
  326. }
  327. }
  328. .reason {
  329. display: flex;
  330. align-items: center;
  331. background-color: #FFF;
  332. height: 80rpx;
  333. // margin: 10rpx 0 0 0;
  334. padding: 10rpx 0 0 20rpx;
  335. >view:nth-of-type(1) {
  336. width: 30%;
  337. }
  338. >view:nth-of-type(2) {
  339. width: 70%;
  340. padding: 0 20rpx 0 0;
  341. }
  342. }
  343. }
  344. .item3 {
  345. // width: 100vw;
  346. .type {
  347. display: flex;
  348. align-items: center;
  349. background-color: #FFF;
  350. height: 80rpx;
  351. padding: 0 0 0 20rpx;
  352. >span:nth-of-type(1) {
  353. width: 70%;
  354. }
  355. >span:nth-of-type(2) {
  356. width: 30%;
  357. }
  358. }
  359. .reason {
  360. display: flex;
  361. align-items: center;
  362. background-color: #FFF;
  363. height: 80rpx;
  364. // margin: 10rpx 0 0 0;
  365. padding: 10rpx 0 0 20rpx;
  366. >view:nth-of-type(1) {
  367. width: 30%;
  368. }
  369. >view:nth-of-type(2) {
  370. width: 70%;
  371. padding: 0 20rpx 0 0;
  372. }
  373. }
  374. }
  375. .item4 {
  376. display: flex;
  377. flex-direction: column;
  378. padding: 10rpx 0 0 20rpx;
  379. background-color: #FFF;
  380. >view:nth-of-type(1) {
  381. background-color: #FFF;
  382. }
  383. >view:nth-of-type(2) {
  384. margin: 10rpx 0 10rpx 0;
  385. background-color: #FFF;
  386. }
  387. }
  388. .item5 {
  389. display: flex;
  390. flex-direction: column;
  391. padding: 0 0 0 20rpx;
  392. background-color: #FFF;
  393. .phone {
  394. display: flex;
  395. align-items: center;
  396. background-color: #FFF;
  397. height: 80rpx;
  398. // margin: 10rpx 0 0 0;
  399. padding: 10rpx 0 0 20rpx;
  400. >view:nth-of-type(1) {
  401. width: 30%;
  402. }
  403. >view:nth-of-type(2) {
  404. width: 70%;
  405. padding: 0 20rpx 0 0;
  406. }
  407. }
  408. }
  409. }
  410. }
  411. </style>