123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571 |
- <template>
- <view class="content">
- <view class="inner">
- <!-- 药品列表 -->
- <view class="drug-list">
- <view class="item">
- <!-- 药品信息 -->
- <view v-if="order!=null&&order.isPackage!=1" class="drug-info" v-for="(item,index) in items"
- :key="index">
- <view class="img-box">
- <image :src="JSON.parse(item.jsonInfo).image" mode="aspectFit"></image>
- </view>
- <view class="info">
- <view class="top">
- <view class="title ellipsis2">{{ JSON.parse(item.jsonInfo).productName}}</view>
- <view class="spec">{{JSON.parse(item.jsonInfo).sku}}</view>
- </view>
- <view class="price-num">
- <view class="price-box">
- <text class="unit">¥</text>
- <text class="price">{{JSON.parse(item.jsonInfo).price.toFixed(2)}}</text>
- </view>
- <view class="num">x{{JSON.parse(item.jsonInfo).num}}</view>
- </view>
- </view>
- </view>
- <view v-if="order!=null&&order.isPackage==1&&order.packageJson!=null" class="drug-info">
- <view class="img-box">
- <image :src="JSON.parse(order.packageJson).imgUrl" mode="aspectFit"></image>
- </view>
- <view class="info">
- <view class="top">
- <view class="title ellipsis2">
- <view class="tag">套餐</view>{{JSON.parse(order.packageJson).title}}
- </view>
- <view class="spec">{{JSON.parse(order.packageJson).descs}}</view>
- </view>
- </view>
- </view>
- </view>
- </view>
- <!-- 申请原因 -->
- <view class="reason-apply">
- <view class="title-box">
- <text class="label">退款金额</text>
- <input class="money" type="text" disabled v-model="refundAmount" placeholder="退款金额"
- placeholder-class="form-input" />
- </view>
- <view class="title-box">
- <text class="label">申请原因</text>
- <picker @change="reasonsChange" :value="reasons" range-key="dictLabel" :range="reasonsList">
- <view class="chose-box">
- <text class="text">{{reasons}}</text>
- <image src="/static/images/arrow_gray.png" mode=""></image>
- </view>
- </picker>
- </view>
- <view class="textarea-box">
- <textarea v-model="explains" placeholder="请描述申请售后服务的具体原因" placeholder-class="textarea-place" />
- </view>
- </view>
- <!-- 退回方式 -->
- <!-- <view class="return-method">
- <view class="title-box">
- <text class="text">退货方式</text>
- <text class="text">用户发货</text>
- </view>
- <view class="return-tips">
- <text class="text">请您在审核通过后7天内,将商品发货到指定点</text>
- </view>
- <view class="info-item">
- <text class="label">联系人</text>
- <text class="text">张三 1572325612</text>
- </view>
- <view class="info-item">
- <text class="label">发货地址</text>
- <text class="text">重庆市江北区建玛特商场5楼</text>
- </view>
- </view> -->
- <!-- 底部按钮 -->
- <view class="btn-box">
- <view class="sub-btn" @click="submit()">申请售后</view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import {
- Dicts,
- getStoreOrderItems, //获取订单项列表
- applyAfterSales, // 申请售后
- revoke //撤销售后
- } from '@/api/order.js'
- // import {applyAfterSales,getStoreOrder} from '@/api/storeAfterSales'
- export default {
- data() {
- return {
- orderId: null,
- order: null,
- orderCode: null,
- items: [],
- type: null,
- reasonsList: [],
- reasons: "请选择",
- explains: "",
- refundAmount: 0.00,
- }
- },
- onLoad(option) {
- this.type = option.type;
- this.orderCode = option.orderCode;
- this.orderId = option.orderId;
- console.log(this.orderId);
- this.getStoreOrder()
- this.getDicts()
- },
- methods: {
- getDicts() {
- var data = {
- key: "store_after_sales_reasons"
- };
- Dicts(data).then(res => {
- if (res.code == 200) {
- this.reasonsList=res.data
- } else {
- uni.showToast({
- icon: 'none',
- title: "请求失败",
- });
- }
- });
- },
- getStoreOrder() {
- var data = {
- orderId: this.orderId
- };
- getStoreOrderItems(data).then(res => {
- if (res.code == 200) {
- this.order = res.order;
- this.items = res.items;
- if (this.order.isPayRemain == 0) {
- this.refundAmount = this.order.totalPrice.toFixed(2)
- } else {
- this.refundAmount = this.order.totalPrice.toFixed(2)
- }
- } else {
- uni.showToast({
- icon: 'none',
- title: "请求失败",
- });
- }
- });
- },
- reasonsChange(e) {
- console.log(e.detail.value)
- this.reasons = this.reasonsList[e.detail.value].dictLabel
- },
- submit() {
- if (this.reasons == "请选择") {
- uni.showToast({
- icon: 'none',
- title: '请选择原因'
- });
- return;
- }
- if (this.refundAmount < 0) {
- uni.showToast({
- icon: 'none',
- title: '请输入退款金额'
- });
- return;
- }
- var productIds = this.items.map(item => item.productId);
- var products = [];
- for (var i = 0; i < productIds.length; i++) {
- var item = {
- productId: productIds[i]
- };
- products.push(item);
- }
- var data = {
- orderId:this.orderId,
- refundType:this.type,//0仅退款1退货退款
- refundAmount: this.refundAmount,
- orderCode: this.orderCode,
- reasons: this.reasons,
- explains: this.explains,
- productList: products
- };
- applyAfterSales(data).then(res => {
- if (res.code == 200) {
- uni.showToast({
- icon: 'success',
- title: '提交成功'
- });
- setTimeout(function() {
- // uni.$emit('refreshOrder');
- // uni.navigateBack({
- // delta: 1
- // })
- uni.redirectTo({
- url: './order'
- })
- }, 500);
- } else {
- uni.showToast({
- icon: 'none',
- title: res.msg
- });
- }
- });
- },
- }
- }
- </script>
- <style lang="scss">
- .content {
- margin-bottom: 170upx;
- .inner {
- padding: 20upx;
- .drug-list {
- .item {
- background: #FFFFFF;
- border-radius: 16upx;
- margin-bottom: 20upx;
- padding: 0 30upx;
- .drug-info {
- display: flex;
- align-items: center;
- padding: 30upx 0;
- .img-box {
- width: 160upx;
- height: 160upx;
- margin-right: 30upx;
- image {
- width: 100%;
- height: 100%;
- }
- }
- .info {
- width: calc(100% - 160upx);
- height: 160upx;
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- .top {
- .title {
- font-size: 28upx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #111111;
- line-height: 1.4;
- .tag {
- display: inline-block;
- padding: 0 6upx;
- height: 30upx;
- background: linear-gradient(90deg, #66b2ef 0%, #0bb3f2 100%);
- border-radius: 4upx;
- margin-right: 10upx;
- font-size: 22upx;
- font-family: PingFang SC;
- font-weight: bold;
- color: #FFFFFF;
- line-height: 30upx;
- float: left;
- margin-top: 7upx;
- }
- }
- .spec {
- font-size: 24upx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #999999;
- line-height: 1;
- margin-top: 14upx;
- }
- }
- .price-num {
- display: flex;
- align-items: center;
- justify-content: space-between;
- .price-box {
- display: flex;
- align-items: flex-end;
- .unit {
- font-size: 24upx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #111111;
- line-height: 1.2;
- margin-right: 5upx;
- }
- .price {
- font-size: 32upx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #111111;
- line-height: 1;
- }
- }
- .num {
- font-size: 24upx;
- font-family: PingFang SC;
- font-weight: bold;
- color: #666666;
- }
- }
- }
- }
- }
- }
- .reason-apply {
- margin-top: 20upx;
- background: #FFFFFF;
- border-radius: 16upx;
- padding: 0 30upx;
- .title-box {
- height: 86upx;
- display: flex;
- align-items: center;
- justify-content: space-between;
- border-bottom: 1px solid #F0F0F0;
- .label {
- font-size: 30upx;
- font-family: PingFang SC;
- font-weight: bold;
- color: #333333;
- }
- .money {
- font-size: 24upx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #999999;
- }
- .chose-box {
- display: flex;
- align-items: center;
- .text {
- font-size: 24upx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #999999;
- }
- image {
- width: 14upx;
- height: 24upx;
- margin-left: 10upx;
- }
- }
- }
- .textarea-box {
- padding: 30upx 0;
- textarea {
- width: 100%;
- box-sizing: border-box;
- background: #F5F5F5;
- border-radius: 16upx;
- padding: 30upx 20upx;
- font-size: 24upx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #111111;
- }
- .textarea-place {
- font-size: 24upx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #999999;
- }
- }
- }
- .return-method {
- background: #FFFFFF;
- border-radius: 16upx;
- margin-top: 20upx;
- padding: 0 30upx 40upx;
- .title-box {
- height: 86upx;
- display: flex;
- align-items: center;
- justify-content: space-between;
- border-bottom: 1px solid #F0F0F0;
- .text {
- font-size: 30upx;
- font-family: PingFang SC;
- font-weight: bold;
- color: #333333;
- }
- }
- .return-tips {
- margin-top: 30upx;
- margin-bottom: 30upx;
- height: 80upx;
- background: #FFF4E6;
- border-radius: 16upx;
- padding: 0 20upx;
- display: flex;
- align-items: center;
- .text {
- font-size: 24upx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #EF8A07;
- }
- }
- .info-item {
- display: flex;
- align-items: center;
- justify-content: space-between;
- margin-bottom: 40upx;
- &:last-child {
- margin-bottom: 0;
- }
- .label {
- font-size: 26upx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #666666;
- line-height: 1;
- }
- .text {
- font-size: 26upx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #111111;
- line-height: 1;
- }
- .detail-box {
- display: flex;
- align-items: center;
- .price-box {
- display: flex;
- align-items: flex-end;
- margin-right: 18upx;
- .unit {
- font-size: 24upx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #111111;
- line-height: 1.2;
- }
- .num {
- font-size: 32upx;
- font-family: PingFang SC;
- font-weight: bold;
- color: #111111;
- line-height: 1;
- }
- }
- .det-text {
- font-size: 26upx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #111111;
- }
- image {
- width: 14upx;
- height: 24upx;
- margin-left: 10upx;
- }
- }
- }
- }
- }
- .reson-box {
- padding: 0 10upx 60upx;
- .reson-item {
- width: 100%;
- height: 110upx;
- display: flex;
- align-items: center;
- justify-content: space-between;
- .title {
- font-size: 30upx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #111111;
- }
- }
- }
- }
- .btn-box {
- height: 120upx;
- padding: 0 30upx;
- display: flex;
- align-items: center;
- justify-content: center;
- .sub-btn {
- width: 100%;
- height: 88upx;
- line-height: 88upx;
- text-align: center;
- font-size: 30upx;
- font-family: PingFang SC;
- font-weight: bold;
- color: #FFFFFF;
- background: #0bb3f2;
- border-radius: 44upx;
- }
- }
- input {
- text-align: right;
- }
- .form-input {
- font-size: 30upx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #999999;
- text-align: right;
- }
- </style>
|