| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298 |
- <template>
- <view>
- <!-- 商品区 -->
- <view class="padding margin-lr margin-tb-sm bg-main border-radius">
- <view class="goods-area" v-for="(item, index) in order_detail" :key="index">
- <view class="dflex">
- <view class="img">
- <image :src="item.goodsMasterImg"></image>
- </view>
- <view class="margin-left-sm">
- <text class="clamp-2">{{ item.goodsName }}</text>
- <view class="ft-dark fs-xs padding-top-xs">
- <text class="margin-right">× {{ item.goodsCount }}</text>
- {{ item.goods_sku_name || ' ' }}
- </view>
- <view class="margin-top-sm">
- <text class="price">{{ item.goodsTotalAmt }}</text>
- </view>
- </view>
- </view>
- </view>
- </view>
- <!-- 退款区 -->
- <view class="padding-lr-xs padding-bottom-sm">
- <use-list-title title="货物状态" type="round" color="#333" :tip="goods_state" iconfont=" "
- @goto="openActionSheet(1)"></use-list-title>
- </view>
- <view class="padding-lr-xs">
- <use-list-title title="退款原因" type="round" color="#333" :tip="reason" iconfont=" "
- @goto="openActionSheet(2)"></use-list-title>
- </view>
- <view class="refund-area padding margin-lr margin-tb-sm bg-main border-radius">
- <view class="dflex-b">
- <text class="item margin-right-sm">退款金额:</text>
- <text class="price">{{refund_money}}</text>
- </view>
- </view>
- <!-- 上传凭证 -->
- <view class="padding margin-lr margin-tb-sm bg-main border-radius">
- <!-- 退款说明 -->
- <textarea v-model="desc" class="ft-black w-full margin-0 padding-0 fs-sm"
- placeholder="请填写退款说明(选填)"></textarea>
- <!-- 上传图片 -->
- <!-- <use-upload class="pos-r" @upload="refundImgs"></use-upload> -->
- </view>
- <!-- 提交操作 -->
- <view class="padding w-full margin-top">
- <view class="dflex-b">
- <view class="tac padding-tb-sm flex1 bg-base-tuikuan" @click="submit">提交申请</view>
- </view>
- </view>
- <!-- 操作菜单 -->
- <use-action-sheet v-model="actionSheetShow" :list="actionSheetList" :tips="actionSheetTips"
- @click="actionSheetClick" @close="actionSheetClose"></use-action-sheet>
- </view>
- </template>
- <script>
- import {
- orderinfo,
- refund
- } from '../../../utils/api_order.js'
- import useListTitle from '../../../components/use-list-title/use-list-title.vue'
- import useUpload from '../../../components/use-upload/use-upload.vue'
- import useActionSheet from '../../../components/use-action-sheet/use-action-sheet.vue'
- export default {
- components:{
- useListTitle,
- useUpload,
- useActionSheet
- },
- data() {
- return {
- issubmit: false,
- goods_state: '请选择',
- reason: '请选择',
- desc: '', // 退款说明
- // 订单ID
- order_id: '',
- // 退款金额
- refund_money: 0,
- // 商品数据
- order_detail: [],
- // 订单数据
- order_data: {},
- postData: {
- order_id: '',
- goods_state: '',
- reason: '',
- desc: '',
- imgs: [],
- refund_money: 0,
- },
- actionSheetShow: false,
- actionSheetList: [],
- actionSheetTips: {
- // text: "退出登录 | 切换账号",
- // color: "#9a9a9a",
- // size: 24
- },
- };
- },
- onUnload() {
- uni.$emit('__event_order', 'refresh');
- },
- onLoad(option) {
- this.order_id = option.order_id;
- if (!this.order_id) {
- this.$api.msg('订单编号不存在');
- }
- this.loadData();
- },
- methods: {
- loadData() {
- let _this = this;
- // 订单详情
- var data=_this.order_id
- orderinfo(data).then((res) => {
- if(res.success){
- _this.order_data = res.data;
- _this.order_detail = res.data.orderDetails;
-
- // 退款金额为实付款金额
- _this.refund_money = _this.order_data.orderActualPrice;
- return
- }
- _this.$api.msg(res.msg);
- })
- },
- refundImgs(options) {
- let imgs = [];
- options.forEach((_) => {
- imgs.push(_.url);
- });
- if (imgs.length > 0) this.postData.imgs = imgs;
- console.log('refundImgs', this.postData.imgs);
- },
- submit() {
- if (!this.postData.goods_state) {
- this.$api.msg('请选择货物状态');
- return;
- }
-
- if (!this.postData.reason) {
- this.$api.msg('请选择退款原因');
- return;
- }
- if (this.issubmit) return;
- this.issubmit = true;
- this.postData.order_id = this.order_id;
- this.postData.refund_money = this.refund_money;
- this.postData.desc = this.desc;
- let _this = this;
- uni.showModal({
- title: '提示',
- content: '申请退款',
- success: function(res) {
- if (res.confirm) {
- //只有代发货状态才能申请退款
- var data=_this.postData.order_id
- refund(data).then((res) => {
- if(res.success){
- _this.$api.msg('提交成功');
- _this.issubmit = false;
- uni.navigateBack({});
- return
- }
- _this.$api.msg(res.msg);
- _this.issubmit = false;
- })
- } else if (res.cancel) {
- console.log('用户点击取消');
- }
- }
- });
- },
- // 打开操作菜单
- openActionSheet(idx) {
- console.log('ppp',idx)
- let type = '';
- let actionSheetList = [];
- switch (idx) {
- case 1:
- type = "货物状态";
- this.actionSheetTips.text = "请选择" + type;
- actionSheetList = [
- // {
- // text: "已收到货",
- // color: "#333",
- // type: type
- // },
- {
- text: "未收到货",
- color: "#333",
- type: type
- }, ];
- break;
- case 2:
- type = "退款原因";
- this.actionSheetTips.text = "请选择" + type;
- actionSheetList = [{
- text: "未发货不要了",
- color: "#333",
- type: type
- }, {
- text: "拍错了,重新下单",
- color: "#333",
- type: type
- }, {
- text: "换一家,质量不好",
- color: "#333",
- type: type
- }, {
- text: "其他",
- color: "#333",
- type: type
- }, ];
- break;
- }
- this.actionSheetShow = true;
- this.actionSheetList = actionSheetList;
- },
- // 关闭操作菜单
- actionSheetClose() {
- this.actionSheetShow = false;
- console.log(this.actionSheetShow);
- },
- // 点击操作菜单
- actionSheetClick(index) {
- let item = this.actionSheetList[index];
- switch (item.type) {
- case '货物状态':
- this.goods_state = item.text;
- this.postData.goods_state = item.text;
- break;
- case '退款原因':
- this.reason = item.text;
- this.postData.reason = item.text;
- break;
- }
- },
- }
- };
- </script>
- <style lang="scss">
- page {
- background: $page-color-base;
- }
- @import url('/packageShang/components/iconfont/iconfont.css');
- @import url('/packageShang/common/common.scss');
- /* 商品区 */
- .goods-area {
- &:last-child {
- margin-bottom: 0;
- }
- image {
- width: 180rpx;
- height: 180rpx;
- }
- }
- /* 退款区 */
- .refund-area {
- line-height: 60rpx;
- .desc {
- line-height: 60rpx;
- }
- }
- </style>
|