From 9287e9a02f9a9a85b0c4dc49f04d1426af4a0ede Mon Sep 17 00:00:00 2001
From: doum <doum>
Date: 星期六, 25 四月 2026 15:16:51 +0800
Subject: [PATCH] 支付宝支付ddd
---
small-program/shop/pages/store-info/store-info.vue | 260 ++++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 233 insertions(+), 27 deletions(-)
diff --git a/small-program/shop/pages/store-info/store-info.vue b/small-program/shop/pages/store-info/store-info.vue
index 0a3ad4c..b593862 100644
--- a/small-program/shop/pages/store-info/store-info.vue
+++ b/small-program/shop/pages/store-info/store-info.vue
@@ -3,56 +3,58 @@
<view class="top-gradient"></view>
<view class="form-card">
<text class="page-title">闂ㄥ簵淇℃伅</text>
-
<view class="form-group">
<text class="label">闂ㄥ簵鍚嶇О</text>
- <input v-model="form.name" class="text-input align-left" type="text" placeholder="璇疯緭鍏ラ棬搴楀悕绉�" placeholder-style="color: #B2B2B2;" />
+ <text class="text-input align-left" style="font-weight: 600;margin-left: 30rpx;">{{info.name}}</text>
</view>
-
+ <view class="form-group">
+ <text class="label">闂ㄥ簵澶村儚</text>
+ <view class="upload-row" style="margin-top: 20rpx;">
+ <view class="upload-box" @click="chooseAndUploadImage(1)">
+ <view class="upload-plus">+</view>
+ <text class="upload-text">涓婁紶鐓х墖</text>
+ </view>
+ <view :key="index" class="photo-box" v-if="form.coverImgUrl">
+ <image class="photo-image" :src="form.coverImgUrl" mode="aspectFill"></image>
+ </view>
+ </view>
+ </view>
<view class="divider"></view>
-
<view class="form-group textarea-group">
<text class="label">闂ㄥ簵浠嬬粛</text>
- <input v-model="form.intro" class="text-input align-left" type="text" placeholder="璇疯緭鍏ラ棬搴椾粙缁�" placeholder-style="color: #B2B2B2;" />
+ <input v-model="form.content" class="text-input align-left" type="text" placeholder="璇疯緭鍏ラ棬搴椾粙缁�" placeholder-style="color: #B2B2B2;" />
</view>
-
<view class="divider"></view>
-
<view class="form-group switch-group">
<view class="label-row">
<text class="label">鏄惁鍏ㄥぉ钀ヤ笟</text>
<text class="required">*</text>
</view>
<view class="switch-row">
- <view class="switch-pill" :class="{ active: !form.fullTime }" @tap="form.fullTime = false">鏄�</view>
- <view class="switch-pill" :class="{ active: form.fullTime }" @tap="form.fullTime = true">鍚�</view>
+ <view class="switch-pill" :class="{ active: form.businessType ===1 }" @tap="form.businessType = 1">鏄�</view>
+ <view class="switch-pill" :class="{ active: form.businessType===0 }" @tap="form.businessType = 0">鍚�</view>
</view>
</view>
-
<view class="form-group">
<view class="label-row">
<text class="label">钀ヤ笟鏃堕棿</text>
<text class="required">*</text>
</view>
- <input v-model="form.businessHours" class="text-input align-left" type="text" placeholder="蹇呭~锛岃杈撳叆闂ㄥ簵钀ヤ笟鏃堕棿" placeholder-style="color: #B2B2B2;" />
+ <input v-model="form.shopHours" class="text-input align-left" type="text" placeholder="蹇呭~锛岃杈撳叆闂ㄥ簵钀ヤ笟鏃堕棿" placeholder-style="color: #B2B2B2;" />
</view>
-
<view class="divider"></view>
-
<view class="form-group">
<text class="label">瀵勫瓨绫诲瀷</text>
- <input v-model="form.storageType" class="text-input align-left" type="text" placeholder="璇疯緭鍏ュ彲瀵勫瓨绫诲瀷" placeholder-style="color: #B2B2B2;" />
+ <input v-model="form.depositTypes" class="text-input align-left" type="text" placeholder="璇疯緭鍏ュ彲瀵勫瓨绫诲瀷" placeholder-style="color: #B2B2B2;" />
</view>
-
<view class="divider"></view>
-
<view class="form-group">
<view class="label-row">
<text class="label">閰嶉�佽寖鍥�</text>
<text class="required">*</text>
</view>
<view class="input-with-unit">
- <input v-model="form.deliveryRange" class="text-input" type="digit" placeholder="蹇呭~锛岃杈撳叆" placeholder-style="color: #B2B2B2;" />
+ <input v-model="form.deliveryArea" class="text-input" type="digit" placeholder="蹇呭~锛岃杈撳叆" placeholder-style="color: #B2B2B2;" />
<text class="unit-text" style="font-size: 28rpx;">鍏噷</text>
</view>
</view>
@@ -64,35 +66,239 @@
<text class="label">鏀惰垂鏍囧噯</text>
<text class="required">*</text>
</view>
- <textarea v-model="form.chargeRule" class="text-area charge-area" placeholder="蹇呭~锛岃杈撳叆闂ㄥ簵鏀惰垂鏍囧噯" placeholder-style="color: #B2B2B2;" auto-height></textarea>
+ <textarea v-model="form.feeStandard" class="text-area charge-area" placeholder="蹇呭~锛岃杈撳叆闂ㄥ簵鏀惰垂鏍囧噯" placeholder-style="color: #B2B2B2;" auto-height></textarea>
</view>
</view>
<view class="save-wrap">
- <view class="save-btn">淇濆瓨</view>
+ <view class="save-btn" @click="maintainShop">淇濆瓨</view>
</view>
</view>
</template>
<script>
+ import { mapState } from 'vuex'
export default {
+ computed: {
+ ...mapState(['navHeight', 'statusbarHeight','shopInfo','shopToken'])
+ },
data() {
return {
- form: {
- name: '',
- intro: '',
- fullTime: true,
- businessHours: '',
- storageType: '',
- deliveryRange: '',
- chargeRule: ''
+ info:{},
+ form:{
+ coverImgUrl:"",
+ businessType: 0,
+ content: "",
+ coverImg: "",
+ deliveryArea: 0,
+ depositTypes:"" ,
+ feeStandard:"" ,
+ shopHours: ""
}
+ }
+ },
+ onShow() {
+ },
+ onLoad() {
+ this.info ={}
+ this.getMyShop()
+ },
+ methods:{
+ previewImage(images,index = 0) {
+ uni.previewImage({
+ current: index,
+ urls: images
+ });
+ },
+ async getMyShop(index){
+ var that =this
+ let res1 = await that.$u.api.getShopInfoDetail()
+ if (res1.code === 200) {
+ this.info = res1.data
+ }
+ let res = await that.$u.api.maintainInfo()
+ if (res.code === 200) {
+ if(res.data){
+ this.form ={
+ coverImgUrl:res.data.coverImgUrl || '',
+ businessType: res.data.businessType || 0,
+ content: res.data.content || '',
+ coverImg: res.data.coverImg || '',
+ deliveryArea: res.data.deliveryArea || 0,
+ depositTypes: res.data.depositTypes || '',
+ feeStandard:res.data.feeStandard || '',
+ shopHours: res.data.shopHours || '',
+ }
+ }
+ }
+ },
+ maintainShop(index){
+ if(this.loading){
+ return;
+ }
+ if(!this.form.shopHours){
+ uni.showToast({
+ title:"璇峰~鍐欒惀涓氭椂闂�",
+ icon:'none'
+ })
+ return
+ }
+ if(!this.form.deliveryArea){
+ uni.showToast({
+ title:"璇峰~鍐欓厤閫佽寖鍥�",
+ icon:'none'
+ })
+ return
+ }
+ if(!this.form.feeStandard){
+ uni.showToast({
+ title:"璇峰~鍐欐敹璐规爣鍑�",
+ icon:'none'
+ })
+ return
+ }
+ this.loading = true
+ try{
+ var that =this
+ that.$u.api.maintainShopInfo(this.form).then(res=>{
+ if (res.code === 200) {
+ uni.showToast({
+ title:"淇℃伅淇濆瓨鎴愬姛",
+ icon:'success'
+ })
+ }
+ this.loading =false
+ })
+ }catch(e){
+ this.loading =false
+ }
+ },
+ async uploadFiles(filePaths, maxCount =1) {
+ console.log("==================================1")
+ if (!filePaths || !filePaths.length) {
+ return null
+ }
+
+ console.log("==================================3")
+ const uploadTasks = filePaths.map(filePath => {
+ return new Promise((resolve, reject) => {
+ uni.uploadFile({
+ url: this.$baseUrl + '/web/public/upload',
+ filePath: filePath,
+ name: 'file',
+ formData: {
+ folder: 'shop'
+ },
+ success: (res) => {
+ if (res.statusCode === 200) {
+ const data = JSON.parse(res.data)
+ if (data.code === 200) {
+ resolve(data.data)
+ } else {
+
+ console.log("==================================6")
+ reject(new Error(data.msg || '涓婁紶澶辫触'))
+ }
+ } else {
+
+ console.log("==================================4")
+ reject(new Error('涓婁紶澶辫触'))
+ }
+ },
+ fail: (err) => {
+
+ console.log("==================================5",err)
+ reject(err)
+ }
+ })
+ })
+ })
+ try {
+ const results = await Promise.all(uploadTasks)
+ return results
+ } catch (error) {
+ uni.showToast({
+ title: '涓婁紶澶辫触',
+ icon: 'none'
+ })
+ throw error
+ }
+ },
+ async chooseAndUploadImage(maxCount = 1) {
+ var that = this
+ uni.chooseImage({
+ count: 1,
+ sizeType: ['compressed'],
+ sourceType: ['album', 'camera'],
+ success: async (res) => {
+ const tempFilePaths = res.tempFilePaths
+ uni.showLoading({
+ title: '涓婁紶涓�...',
+ mask: true
+ })
+ try {
+ const uploadResults = await that.uploadFiles(tempFilePaths, maxCount)
+
+ that.form.coverImgUrl = uploadResults.map(item => item.url || item.path || item)[0]
+ that.form.coverImg = uploadResults.map(item => item.imgaddr)[0]
+ console.log(that.form,"=====================================01")
+ uni.hideLoading()
+ uni.showToast({
+ title: '涓婁紶鎴愬姛',
+ icon: 'success'
+ })
+ } catch (error) {
+ uni.hideLoading()
+ }
+ }
+ })
}
}
}
</script>
<style lang="scss" scoped>
+ .upload-row {
+ display: flex;
+ align-items: flex-start;
+ gap: 10rpx;
+ margin-bottom: 22rpx;
+ }
+
+ .upload-box,
+ .photo-box {
+ width: 122rpx;
+ height: 122rpx;
+ border-radius: 0;
+ overflow: hidden;
+ position: relative;
+ box-sizing: border-box;
+ }
+
+ .upload-box {
+ border: 1rpx dashed #c8ccd4;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ }
+
+ .upload-plus {
+ font-size: 54rpx;
+ line-height: 1;
+ color: #999999;
+ }
+
+ .upload-text {
+ margin-top: 8rpx;
+ font-size: 24rpx;
+ color: #999999;
+ }
+
+ .photo-image {
+ width: 100%;
+ height: 100%;
+ }
.store-info-page {
position: relative;
height: 482rpx;
--
Gitblit v1.9.3