多租户商城-商户小程序端
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.

407 lines
10 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. <!-- 申请售后 -->
  2. <template>
  3. <view>
  4. <global-loading />
  5. <view class="content">
  6. <view class="order-list-box">
  7. <view class="item">
  8. <view class="order-info-box">
  9. <view class="order-info">
  10. <u-checkbox-group @change="checkboxGroupChange">
  11. <u-checkbox
  12. active-color="#252744"
  13. shape="circle"
  14. size="40"
  15. v-for="(item, index) in item.skus"
  16. :key="index"
  17. v-model="item.checked"
  18. :name='item.skuId'
  19. @change="checkboxChange(item)">
  20. <view class="order-info-item">
  21. <image :src="item.image"
  22. class="product-img"></image>
  23. <view class="info-box">
  24. <text class="product-name">{{ item.productName }}</text>
  25. <view class="product-sku">{{ item.value }}</view>
  26. <view class="price-sku-box">
  27. <text class="product-price">
  28. <text class="fuhao"></text>
  29. {{ item.price }}
  30. </text>
  31. <text class="product-num">x {{ item.number }}</text>
  32. </view>
  33. </view>
  34. </view>
  35. </u-checkbox>
  36. </u-checkbox-group>
  37. </view>
  38. </view>
  39. </view>
  40. </view>
  41. <view class="afterSale-select-box">
  42. <view class="selectBtn flex-items flex-sp-between">
  43. <view class="selectBox">
  44. <checkbox-group name="allCheck"
  45. @change="changeAll">
  46. <label>
  47. <checkbox color="#252744"
  48. :value="allCheck.value"
  49. :checked="allCheck.checked"/>
  50. <text>{{ allCheck.name }}</text>
  51. </label>
  52. </checkbox-group>
  53. </view>
  54. <view class="selectRight flex-items">
  55. <view style="margin-right: 12rpx">{{ number || 0 }}件商品</view>
  56. <view class="totalPrice">合计
  57. <text>{{ total.toFixed(2) }}</text>
  58. </view>
  59. </view>
  60. </view>
  61. <view class="afterBtnBox flex-items flex-sp-between">
  62. <view class="afterBtn1"
  63. @click="ReturnMoney(item)">{{$t('common.refund_only')}}
  64. </view>
  65. <view v-if="distribution !== 1"
  66. class="afterBtn2"
  67. @click="ReturnGoods(item)">{{$t('common.refunds_and_returns')}}
  68. </view>
  69. </view>
  70. </view>
  71. </view>
  72. </view>
  73. </template>
  74. <script>
  75. const NET = require('../../utils/request')
  76. const API = require('../../config/api')
  77. export default {
  78. data() {
  79. return {
  80. item: {},
  81. checkboxChangelist: [],
  82. xuanzlist: [],
  83. allCheck: {
  84. name: this.$t('common.chooseall'),
  85. value: 'all',
  86. checked: false
  87. },
  88. number: null,
  89. total: 0,
  90. distribution: null,
  91. isAllSelect: 0,
  92. evaluated: 0,//待评价订单申请
  93. }
  94. },
  95. onLoad(options) {
  96. this.item = JSON.parse(options.item)
  97. this.distribution = this.item.skus[0].distribution
  98. if([2].includes(this.item.state)){
  99. this.distribution = 1
  100. }
  101. this.evaluated = options.isAllSelect
  102. // this.item.skus.forEach((item) => {
  103. // this.number = this.number + item.number
  104. // this.total = this.total + item.total
  105. // })
  106. },
  107. methods: {
  108. // 算钱
  109. HandleGetRefundMoney() {
  110. return new Promise((resolve, reject) => {
  111. if (this.xuanzlist.length <= 0) {
  112. resolve(0)
  113. return
  114. }
  115. // uni.showLoading({
  116. // title: "计算中..."
  117. // })
  118. let postData = {
  119. orderId: this.item.orderId,
  120. isAllSelect: this.evaluated == 1 ? this.xuanzlist.length === this.item.skus.length ? 1 : 0 : 0,
  121. skus: this.xuanzlist
  122. }
  123. NET.request(API.GetRefundMoney, postData, "POST").then(res => {
  124. uni.hideLoading()
  125. resolve(parseFloat(res.json))
  126. })
  127. })
  128. },
  129. // 申请退款
  130. ReturnMoney(item) {
  131. if (this.xuanzlist.length <= 0) {
  132. uni.showToast({
  133. title: '请选择退款的商品',
  134. duration: 2000,
  135. icon: 'none'
  136. })
  137. } else {
  138. uni.setStorageSync('afterSaleApplyRefund', this.xuanzlist)
  139. uni.navigateTo({
  140. url: 'afterSaleApplyRefund?orderId=' + this.item.orderId + '&isAllSelect=' + (this.evaluated==1?this.isAllSelect:0)
  141. })
  142. }
  143. },
  144. // 全选
  145. async changeAll(e) {
  146. if (e.detail.value.length == 0) {
  147. this.item.skus.map(item => this.$set(item, 'checked', false));
  148. this.$set(this.allCheck, 'checked', false);
  149. this.xuanzlist = []
  150. if (this.item.state === 4 && this.evaluated != undefined) {
  151. this.isAllSelect = this.evaluated
  152. } else {
  153. this.isAllSelect = 0
  154. }
  155. } else {
  156. this.item.skus.map(item => this.$set(item, 'checked', true));
  157. this.$set(this.allCheck, 'checked', true);
  158. if (this.item.state === 4 && this.evaluated != undefined) {
  159. this.isAllSelect = this.evaluated
  160. } else {
  161. this.isAllSelect = 1
  162. }
  163. this.xuanzlist = this.item.skus.filter(item => item.checked == true)
  164. this.number = 0
  165. // this.total = 0
  166. this.item.skus.forEach((item) => {
  167. this.number = this.number + item.number
  168. // this.total = this.total + item.total
  169. })
  170. }
  171. this.total = await this.HandleGetRefundMoney()
  172. },
  173. // 申请退货
  174. ReturnGoods(item) {
  175. if (this.xuanzlist.length <= 0) {
  176. uni.showToast({
  177. title: '请选择退货的商品',
  178. duration: 2000,
  179. icon: 'none'
  180. })
  181. } else {
  182. uni.navigateTo({
  183. url: 'afterSaleApplyRetund?list=' + encodeURIComponent(JSON.stringify(this.xuanzlist)) + '&orderId=' + this.item.orderId + '&isAllSelect='+ (this.evaluated==1?this.isAllSelect:0)
  184. })
  185. }
  186. },
  187. checkboxGroupChange(e) {
  188. // console.log(e, 'fdsfdsfsdf')
  189. },
  190. async checkboxChange(e) {
  191. // 动态设置商品件数和总计
  192. if (e.checked) {
  193. this.number = this.number + e.number
  194. // this.total = this.total + e.total
  195. } else {
  196. this.number = this.number - e.number
  197. // this.total = this.total - e.total
  198. }
  199. // 筛选勾选的
  200. this.xuanzlist = this.item.skus.filter(item => item.checked == true)
  201. // 是否为全选
  202. if (this.item.skus.length == this.xuanzlist.length) {
  203. if (this.item.state === 4 && this.evaluated != undefined) {
  204. this.isAllSelect = this.evaluated
  205. } else {
  206. this.isAllSelect = 1
  207. }
  208. this.$set(this.allCheck, 'checked', true);
  209. } else {
  210. if (this.item.state === 4 && this.evaluated != undefined) {
  211. this.isAllSelect = this.evaluated
  212. } else {
  213. this.isAllSelect = 0
  214. }
  215. this.$set(this.allCheck, 'checked', false);
  216. }
  217. this.total = await this.HandleGetRefundMoney()
  218. // if(this.xuanzlist.findIndex(item=>item.checked===true)==-1){
  219. // console.log(this.allCheck,'this.allCheck')
  220. // console.log(this.xuanzlist,'this.xuanzlist')
  221. // this.$set(this.allCheck, 'checked', false);
  222. // } else {
  223. // console.log(this.allCheck,'this.allCheck')
  224. // this.$set(this.allCheck, 'checked', true);
  225. // console.log(this.xuanzlist,'this.xuanzlist')
  226. // }
  227. }
  228. }
  229. }
  230. </script>
  231. <style lang="scss"
  232. scoped>
  233. page {
  234. background: #F8F8F8;
  235. }
  236. .order-list-box {
  237. padding: 20upx 30upx;
  238. box-sizing: border-box;
  239. }
  240. .order-list-box .item {
  241. background: #fff;
  242. border-radius: 10upx;
  243. }
  244. .order-list-top {
  245. height: 96upx;
  246. padding: 0 30upx;
  247. box-sizing: border-box;
  248. display: flex;
  249. flex-direction: row;
  250. align-items: center;
  251. justify-content: space-between;
  252. border-bottom: 1px solid #eee;
  253. }
  254. .top-l {
  255. display: flex;
  256. flex-direction: row;
  257. align-items: center;
  258. }
  259. .shop-img {
  260. width: 36upx;
  261. height: 36upx;
  262. margin-right: 10upx;
  263. }
  264. .shop-name {
  265. font-size: 30upx;
  266. color: #333;
  267. font-weight: bold;
  268. }
  269. .arrow-img {
  270. margin-left: 15upx;
  271. width: 24upx;
  272. height: 24upx;
  273. }
  274. .order-status {
  275. font-size: 28upx;
  276. color: #ff7911;
  277. font-weight: 500;
  278. }
  279. .order-info-box {
  280. padding: 0 30upx;
  281. box-sizing: border-box;
  282. }
  283. .order-info {
  284. /* border-bottom: 1px solid #eee; */
  285. }
  286. .order-info-item {
  287. display: flex;
  288. flex-direction: row;
  289. padding: 10upx 20upx;
  290. border-bottom: solid 1px #eee;
  291. width: 600rpx;
  292. }
  293. .order-info-item:last-child {
  294. border-bottom: none;
  295. }
  296. .product-img {
  297. width: 180upx;
  298. height: 180upx;
  299. border-radius: 10upx;
  300. margin-right: 30upx;
  301. }
  302. .info-box {
  303. flex: 1;
  304. display: flex;
  305. flex-direction: column;
  306. }
  307. .product-name {
  308. font-size: 28rpx;
  309. color: #252744;
  310. //height: 68upx;
  311. //line-height: 34upx;
  312. display: -webkit-box;
  313. overflow: hidden;
  314. text-overflow: ellipsis;
  315. word-break: break-all;
  316. -webkit-box-orient: vertical;
  317. -webkit-line-clamp: 2;
  318. }
  319. .price-sku-box {
  320. display: flex;
  321. flex-direction: row;
  322. justify-content: space-between;
  323. margin-top: 10upx;
  324. }
  325. .product-sku {
  326. font-size: 28rpx;
  327. color: #90919C;
  328. margin-top: 12rpx;
  329. }
  330. .product-price {
  331. font-size: 32rpx;
  332. color: #252744;
  333. font-weight: 400;
  334. }
  335. .product-price .fuhao {
  336. font-size: 32rpx;
  337. }
  338. .product-num {
  339. font-size: 32rpx;
  340. color: #90919C;
  341. }
  342. .afterSale-select-box {
  343. position: fixed;
  344. bottom: 0;
  345. width: 100%;
  346. background: #fff;
  347. padding: 30rpx;
  348. box-sizing: border-box;
  349. height: 240rpx;
  350. }
  351. .afterBtnBox {
  352. margin-top: 30rpx;
  353. .afterBtn1 {
  354. width: 342rpx;
  355. line-height: 100rpx;
  356. border: 1rpx solid #252744;
  357. text-align: center;
  358. color: #252744;
  359. border-radius: 50rpx;
  360. margin-right: 30rpx;
  361. }
  362. .afterBtn2 {
  363. width: 342rpx;
  364. height: 100rpx;
  365. line-height: 100rpx;
  366. background: #333333;
  367. border: 1rpx solid #252744;
  368. border-radius: 50rpx;
  369. text-align: center;
  370. color: #252744;
  371. }
  372. }
  373. .selectBox /deep/ .uni-checkbox:not([disabled]) .uni-checkbox-input:hover {
  374. border-color: #252744;
  375. }
  376. </style>