| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292 |
- <template>
- <view class="container">
- <uni-nav-bar title="门店信息" backgroundColor='#03803B' color="#fff" left-icon="left" fixed statusBar
- @clickLeft='goBack()' @clickRight="addDetails" rightWidth="140rpx">
- <block slot="right">
- <view style="font-size: 26rpx;">
- <!-- <image class="nav-right" src="@/static/images/home/store/add.png" /> -->
- +添加门店
- </view>
- </block>
- </uni-nav-bar>
- <view style="background-color: #fff;">
- <uni-search-bar bgColor="#F6F6F6 " v-model="searchValue" placeholder="请输入店铺名称" @confirm="searchChange"
- cancelButton="none" @clear="searchChange">
- </uni-search-bar>
- </view>
- <z-paging ref="paging" v-model="dataList" @query="getList" :fixed="false" :auto-show-back-to-top="true"
- :empty-view-text="searchValue ? '未找到相关结果' : '暂无数据'" :hide-empty-view="false"
- :auto-show-system-loading="true">
- <view class="list">
- <view style="margin-top: 30rpx;" v-for="(item, index) in dataList" :key="index" @click="inEdit(item)">
- <uni-swipe-action>
- <uni-swipe-action-item>
- <view class="tab-bar-item">
- <image class="icon" :src="item.url" />
- <view class="text">
- <view class="text_title">
- <text style="color: #03803B;">店铺名称:</text>
- <text style="color: #6A6A6A" class='uni-lastmsg'>{{item.cname||'-'}}</text>
- </view>
- <view class="text_content">
- <text style="color: #03803B;">前置仓:</text>
- <text style="color: #6A6A6A"
- class='uni-lastmsg2'>{{item.deliveryWarehouseName||'暂无仓库'}}</text>
- <text style="color: #03803B;margin-left: 10rpx;">价格:</text>
- <text style="color: #6A6A6A"
- class='uni-lastmsg2'>¥{{item.priceSystem||0}}</text>
- </view>
- <view class="text_foot">
- <text style="color: #03803B;">电话:</text>
- <text style="color: #6A6A6A">{{item.tel}}</text>
- </view>
- </view>
- <view class="menu">
- <view class="">
- <image class="edit" src="@/static/images/home/store/edit.png" />
- </view>
- <view class="">
- <image class="QR" src="@/static/images/home/store/QR.png"
- @click.stop="inQR(item)" />
- </view>
- </view>
- </view>
- <template v-slot:right>
- <view @click.stop="onClick(item)"
- style="width: 120rpx;background-color:#e43d33;display: flex;justify-content: center;align-items: center;color: #fff;">
- <text>删除</text>
- </view>
- </template>
- </uni-swipe-action-item>
- </uni-swipe-action>
- </view>
- </view>
- </z-paging>
- <uni-popup ref="popup">
- <image style="width: 400rpx;height: 400rpx;background-color: #fff;" :src="imgPopup" />
- </uni-popup>
- </view>
- </template>
- <script>
- import {
- getList,
- remove,
- generateQrCode
- } from '@/api/home/store.js'
- export default {
- data() {
- return {
- searchValue: null,
- dataList: [],
- imgPopup: null,
- }
- },
- onLoad() {
-
- },
- onShow() {
- if (uni.getStorageSync('isUpdate')) {
- this.$nextTick(() => {
- if (this.$refs.paging) {
- this.$refs.paging.reload();
- }
- });
- uni.removeStorageSync('isUpdate')
- }
- },
- methods: {
- onClick(row) {
- let _this = this
- uni.showModal({
- title: '提示',
- content: '是否确认删除?',
- success: function(res) {
- if (res.confirm) {
- uni.showLoading({
- title: '加载中',
- mask: true
- });
- remove(row.id).then(res => {
- uni.showToast({
- title: '操作成功',
- icon: 'none',
- duration: 2000
- });
- _this.searchChange()
- })
- .finally(() => {
- uni.hideLoading()
- });
- }
- }
- });
- },
- addDetails() {
- uni.navigateTo({
- url: '/pages/home/store/details'
- });
- },
- inEdit(row) {
- uni.navigateTo({
- url: '/pages/home/store/details?id=' + row.id,
- });
- },
- inQR(row) {
- this.imgPopup = null
- uni.showLoading({
- title: '加载中',
- mask: true
- });
- generateQrCode({
- corpId: row.id
- }).then(res => {
- // uni.previewImage({
- // urls: [res.data.filePath],
- // });
- this.$refs.popup.open()
- this.imgPopup = res.data.filePath
- })
- .finally(() => {
- uni.hideLoading()
- });
- // uni.showToast({
- // title: '暂无二维码',
- // icon: 'none'
- // });
- },
- searchChange() {
- this.$refs.paging.reload()
- },
- async getList(pageNo, pageSize) {
- try {
- const obj = {
- retrieve: this.searchValue,
- current: pageNo,
- size: pageSize
- }
- const res = await getList(obj)
- this.$refs.paging.complete(res.data.records)
- } catch (e) {
- this.$refs.paging.complete(false)
- uni.showToast({
- title: '加载失败',
- icon: 'none'
- })
- }
- },
- goBack() {
- uni.navigateBack({
- delta: 1,
- });
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .scroll-view {
- flex: 1;
- height: 100%;
- /* 关键样式:防止内容被裁剪 */
- overflow-anchor: none;
- }
- .container {
- height: 100vh;
- display: flex;
- flex-direction: column;
- }
- .loading,
- .no-more {
- text-align: center;
- padding: 20px;
- color: #999;
- }
- .uni-lastmsg {
- width: 260rpx;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- display: block;
- /* 需明确设置display */
- }
- .uni-lastmsg2 {
- width: 140rpx;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- display: block;
- /* 需明确设置display */
- }
- .nav-right {
- width: 54rpx;
- height: 54rpx;
- }
- .list {
- width: 100%;
- .tab-bar-item {
- background-color: #fff;
- padding: 30rpx 62rpx;
- display: flex;
- .icon {
- width: 140rpx;
- height: 140rpx;
- // background: #909090;
- border-radius: 14rpx;
- }
- .text {
- padding: 0rpx 17rpx;
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- height: 140rpx;
- .text_title {
- display: flex;
- height: 44rpx;
- font-weight: 500;
- font-size: 28rpx;
- color: #6A6A6A;
- }
- .text_content {
- display: flex;
- font-size: 28rpx;
- font-weight: 500;
- }
- .text_foot {
- font-size: 28rpx;
- font-weight: 500;
- }
- }
- .menu {
- position: absolute;
- right: 62rpx;
- .edit {
- margin-top: 10rpx;
- width: 30rpx;
- height: 33rpx;
- }
- .QR {
- margin-top: 54rpx;
- width: 30rpx;
- height: 31rpx;
- }
- }
- }
- }
- </style>
|