123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293 |
- <template>
- <mobile-frame>
- <view class="main">
- <view class="one">
- <input type="text" v-model="searchInfo.name" @input="toInput" placeholder="搜索商品">
- </view>
- <view class="two">
- <scroll-view scroll-y="true" class="scroll-view" @scrolltolower="toPage">
- <view class="list-scroll-view">
- <view class="list" v-for="(item,index) in list" :key="index">
- <view class="list_1">
- <view class="shopname">
- <text class="iconfont icon-shangdian"></text>
- <text>{{item.shop.name}}</text>
- </view>
- <view class="type">
- {{item.zhType||'暂无'}}
- </view>
- </view>
- <view class="list_2">
- <image class="image" :src="item.url&&item.url.length>0?item.url[0].url:''" mode="">
- </image>
- <view class="other">
- <view class="name">
- {{item.goods.goods.name||'暂无'}}
- </view>
- <view class="other_1">
- 商品规格:<text>{{item.goods.name||'暂无'}}</text>
- </view>
- <view class="other_1" v-if="item.type!='2'">
- 退款:<text>¥{{item.money||0}}</text>
- </view>
- <view class="other_1">
- 申请时间:<text>{{item.apply_time||'暂无'}}</text>
- </view>
- <view class="other_1">
- 售后描述:<text>{{item.desc||'暂无'}}</text>
- </view>
- </view>
- </view>
- <view class="btn">
- <button type="default" size="mini" @click="toCancel(item)">取消售后</button>
- <button v-if="item.type!='0'" type="default" size="mini"
- @click="toRevise(item)">维护信息</button>
- </view>
- </view>
- </view>
- </scroll-view>
- </view>
- </view>
- </mobile-frame>
- </template>
- <script>
- export default {
- data() {
- return {
- user: {},
- list: [],
- typeList: [],
- total: 0,
- skip: 0,
- limit: 5,
- page: 0
- };
- },
- onShow: async function() {
- const that = this;
- that.clearPage();
- // 查询其他信息
- await that.searchOther();
- // 监听用户登录
- await that.watchLogin();
- },
- methods: {
- // 维护信息
- toRevise(e) {
- uni.navigateTo({
- url: `/pagesMy/order/detail?id=${e.id||e._id}`
- })
- },
- // 取消售后
- toCancel(e) {
- const that = this;
- uni.showModal({
- title: '提示',
- content: '确定删除售后申请吗?',
- success: async function(res) {
- if (res.confirm) {
- const arr = await that.$api(`/afterSale/${e._id}`, 'DELETE');
- if (arr.errcode == '0') {
- uni.showToast({
- title: '删除售后成功',
- icon: 'none'
- })
- that.clearPage();
- that.search();
- } else {
- uni.showToast({
- title: arr.errmsg,
- icon: 'none'
- })
- }
- }
- }
- });
- },
- // 监听用户是否登录
- watchLogin() {
- const that = this;
- uni.getStorage({
- key: 'token',
- success: function(res) {
- let user = that.$jwt(res.data);
- if (user) that.$set(that, `user`, user);
- that.search();
- },
- fail: function(err) {
- uni.navigateTo({
- url: `/pages/login/index`
- })
- }
- });
- },
- // 查询列表
- async search() {
- const that = this;
- let user = that.user;
- const arr = await that.$api(`/afterSale`, 'GET', {
- customer: user._id
- });
- if (arr.errcode == '0') {
- let list = [...that.list, ...arr.data];
- for (let val of list) {
- let type = that.typeList.find(i => i.value == val.type)
- if (type) val.zhType = type.label;
- val.url = val?.goods?.goods?.file;
- }
- that.$set(that, `list`, list)
- that.$set(that, `total`, arr.total)
- } else {
- uni.showToast({
- title: arr.errmsg,
- });
- }
- },
- // 查询其他信息
- async searchOther() {
- const that = this;
- let res;
- res = await that.$api(`/dictData`, 'GET', {
- code: "afterSale_type"
- });
- if (res.errcode == '0') {
- that.$set(that, `typeList`, res.data)
- }
- },
- // 分页
- toPage(e) {
- const that = this;
- let list = that.list;
- let limit = that.limit;
- if (that.total > list.length) {
- uni.showLoading({
- title: '加载中',
- mask: true
- })
- let page = that.page + 1;
- that.$set(that, `page`, page)
- let skip = page * limit;
- that.$set(that, `skip`, skip)
- that.search();
- uni.hideLoading();
- } else uni.showToast({
- title: '没有更多数据了'
- });
- },
- // 清空列表
- clearPage() {
- const that = this;
- that.$set(that, `list`, [])
- that.$set(that, `skip`, 0)
- that.$set(that, `limit`, 5)
- that.$set(that, `page`, 0)
- }
- }
- }
- </script>
- <style lang="scss">
- .main {
- display: flex;
- flex-direction: column;
- width: 100vw;
- height: 100vh;
- .one {
- border-bottom: 1px solid var(--f85Color);
- padding: 2vw;
- input {
- padding: 2vw;
- background-color: var(--f1Color);
- font-size: var(--font14Size);
- border-radius: 5px;
- }
- }
- .two {
- position: relative;
- flex-grow: 1;
- background-color: var(--f9Color);
- .list {
- margin: 2vw;
- background-color: var(--fffColor);
- padding: 2vw;
- width: 92vw;
- border-radius: 5px;
- .list_1 {
- display: flex;
- justify-content: space-between;
- font-size: var(--font16Size);
- margin: 0 0 2vw 0;
- .shopname {
- text {
- margin: 0 0 0 1vw;
- }
- }
- .type {
- color: var(--ff0Color);
- }
- }
- .list_2 {
- display: flex;
- justify-content: space-between;
- align-items: center;
- .image {
- width: 25vw;
- height: 25vw;
- margin: 0 2vw 1vw 0;
- }
- .other {
- flex-grow: 1;
- .name {
- font-size: var(--font16Size);
- }
- .other_1 {
- font-size: var(--font14Size);
- text {
- color: var(--f85Color);
- }
- }
- }
- }
- .btn {
- text-align: right;
- button {
- margin: 2vw 0 0 2vw;
- }
- }
- }
- .list:nth-child(2n) {
- margin: 0 0 2vw 0;
- }
- }
- }
- .scroll-view {
- position: absolute;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- .list-scroll-view {
- display: flex;
- flex-direction: column;
- }
- }
- </style>
|