Merge branch 'pre-release' of https://gitea.lihaink.cn/mkm/shop-applet into pre-release
This commit is contained in:
commit
b7be7ef93e
|
@ -2,8 +2,8 @@
|
|||
"name" : "惠农商户平台",
|
||||
"appid" : "__UNI__7626C0F",
|
||||
"description" : "",
|
||||
"versionName" : "1.5.1",
|
||||
"versionCode" : 1510,
|
||||
"versionName" : "1.5.3",
|
||||
"versionCode" : 1530,
|
||||
"transformPx" : false,
|
||||
/* 5+App特有相关 */
|
||||
"app-plus" : {
|
||||
|
|
|
@ -198,7 +198,6 @@
|
|||
that.$util.Tips({
|
||||
title: res.message
|
||||
});
|
||||
that.getOrderData();
|
||||
})
|
||||
.catch(res => {
|
||||
that.$util.Tips({
|
||||
|
|
|
@ -229,7 +229,8 @@
|
|||
<u-line direction="col" style="margin: 0 20rpx;" length="60rpx"
|
||||
color="#A1A1A1"></u-line>
|
||||
</view>
|
||||
<view class="attribute-li" v-for="item in product_attribute.attr">
|
||||
<view class="attribute-li" v-for="item in product_attribute.attr"
|
||||
v-if="item.label || item.value">
|
||||
<view class="" style="display: flex;flex-direction: column;align-items: center;">
|
||||
<view class="" style="margin-bottom: 10rpx;">
|
||||
{{item.label}}
|
||||
|
@ -238,8 +239,8 @@
|
|||
{{item.value}}
|
||||
</view>
|
||||
</view>
|
||||
<u-line direction="col" style="margin: 0 20rpx;" length="60rpx"
|
||||
color="#A1A1A1"></u-line>
|
||||
<u-line direction="col" style="margin: 0 20rpx;" length="60rpx" color="#A1A1A1"
|
||||
v-if="item.label || item.value"></u-line>
|
||||
</view>
|
||||
<view class="attribute-fixed-right" v-if="storeInfo.product_attribute.attr.length>5">
|
||||
<u-icon name="arrow-right"></u-icon>
|
||||
|
@ -755,9 +756,10 @@
|
|||
getPreviewProDetail(params).then(res => {
|
||||
uni.hideLoading();
|
||||
let storeInfo = res.data;
|
||||
// this.product_attribute = res.data.product_attribute
|
||||
|
||||
console.log(res.data.product_attribute);
|
||||
if (res.data.product_attribute)
|
||||
this.product_attribute = res.data.product_attribute
|
||||
|
||||
this.image = res.data.image;
|
||||
|
||||
if (storeInfo.video_link && storeInfo.slider_image.length > 1) {
|
||||
|
|
|
@ -830,7 +830,6 @@
|
|||
}
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
this.getGoods(true);
|
||||
this.list1();
|
||||
this.getUserInfo();
|
||||
this.codelist();
|
||||
|
@ -873,26 +872,6 @@
|
|||
}
|
||||
},
|
||||
onReady() {
|
||||
// if (Boolean(this.$store.state.app.userInfo.service?.mer_id)) {
|
||||
// isNewMer(this.$store.state.app.userInfo.uid, this.$store.state.app.userInfo.service?.mer_id).then(res => {
|
||||
// if (res.data == 'true') {
|
||||
// let that = this
|
||||
// const query = uni.createSelectorQuery().in(this);
|
||||
// query
|
||||
// .select(".tools-two-img")
|
||||
// .boundingClientRect((data) => {
|
||||
// let info = JSON.stringify(data)
|
||||
// that.elInfo = data
|
||||
// // #ifdef APP-PLUS
|
||||
// that.openDiver()
|
||||
// // #endif
|
||||
// })
|
||||
// .exec();
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
|
||||
|
||||
},
|
||||
|
||||
onShow() {
|
||||
|
@ -901,7 +880,6 @@
|
|||
this.getUserInfo();
|
||||
} else {
|
||||
this.isNewUser()
|
||||
console.log('1111111111')
|
||||
}
|
||||
// this.getGoods(true);
|
||||
},
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
<view class="card" style="min-height: 268rpx;">
|
||||
<u-form-item label="商品图片" prop="formData.imageList" ref="item1" labelWidth='auto'>
|
||||
<text style="font-size:24rpx ; color:#E18C34 ;">上传时应注重真实性、清晰度</text>
|
||||
<text style="font-size:24rpx ; color:#E18C34 ;">上传时应注重真实性、清晰度、至少上传两张</text>
|
||||
</u-form-item>
|
||||
<view class="" style="display: flex;flex-wrap: wrap;">
|
||||
<view v-for="(item,index) in formData.imageList" style="margin-right: 20rpx;margin-bottom: 20rpx;">
|
||||
|
@ -175,7 +175,7 @@
|
|||
|
||||
data() {
|
||||
return {
|
||||
coverUrl: '?spm=a2c4e.11153940.blogcont573781.6.c1032027sQ46VG&x-oss-process=video/snapshot,t_1000,m_fast',
|
||||
coverUrl: '?x-oss-process=video/snapshot,t_1000,m_fast,ar_auto',
|
||||
videoIndex: 0,
|
||||
showVideo: false,
|
||||
upload_max: 100,
|
||||
|
@ -354,7 +354,20 @@
|
|||
console.log("字符串中没有找到点号。");
|
||||
}
|
||||
},
|
||||
choseMedia(e) {
|
||||
async choseMedia(e) {
|
||||
|
||||
// #ifdef APP-PLUS
|
||||
let result = await this.$store.dispatch("permission/requestPermissions",
|
||||
'CAMERA')
|
||||
if (result !== 1) {
|
||||
return
|
||||
}
|
||||
result = await this.$store.dispatch("permission/requestPermissions",
|
||||
'READ_EXTERNAL_STORAGE')
|
||||
if (result !== 1) {
|
||||
return
|
||||
}
|
||||
// #endif
|
||||
console.log(e.value)
|
||||
this.show = false
|
||||
if (e.value[0] == '图片') {
|
||||
|
|
|
@ -62,7 +62,6 @@
|
|||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
<u-form-item label="商品详情" prop="formData.content.image" required>
|
||||
<text style="color: #E18C34;font-size: 24rpx">上传时应注重真实性、清晰度</text>
|
||||
</u-form-item>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<view class="content">
|
||||
<u--form :model="model1" ref="uForm" labelPosition="left" :labelStyle="{fontSize:'32rpx',color:'#444444'}"
|
||||
labelWidth='120' borderBottom>
|
||||
labelWidth='120' borderBottom style="padding-bottom: 100rpx;">
|
||||
|
||||
<view class="description">
|
||||
产品属性
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
<template>
|
||||
<view class="content">
|
||||
<view class="">
|
||||
<u-button icon="plus" text="新增规格" @click="pushFn" class="custom-style" iconColor='#38BE41'></u-button>
|
||||
</view>
|
||||
|
||||
<view class="card" v-for="(item,index) in attrValue">
|
||||
<view class="card-head card-li">
|
||||
<text style="font-size: 32rpx;">规格{{index+1}}</text>
|
||||
|
@ -17,13 +15,14 @@
|
|||
<view class="">
|
||||
<view class="" style="display: flex;align-items: center;justify-content: space-between;">
|
||||
<u--input style="flex: 2; background-color: #F6F6F6;" placeholder="请输入商品单价" v-model="item.price"
|
||||
type='number'></u--input>
|
||||
placeholderStyle="font-size:26rpx;color:rgb(192, 196, 204);" type='number'></u--input>
|
||||
<view class="" style="flex: 1;text-align: center;">
|
||||
/
|
||||
</view>
|
||||
<view class="" @click="unitIptClick(index,false)" style="width: 100rpx;flex: 2.4">
|
||||
<u--input readonly style=" background-color: #F6F6F6;pointer-events: none;"
|
||||
placeholder="请输入计量单位" v-model="item.unit_name"></u--input>
|
||||
placeholderStyle="font-size:26rpx;color:rgb(192, 196, 204);" placeholder="请输入计量单位"
|
||||
v-model="item.unit_name"></u--input>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
@ -45,7 +44,8 @@
|
|||
<view class=" card-li">
|
||||
<text style="font-size: 32rpx;">商品库存</text>
|
||||
<view class="" style="width: 300rpx;">
|
||||
<u--input type='number' placeholder="请填写库存数量" inputAlign='right' v-model="item.stock"></u--input>
|
||||
<u--input type='number' placeholder="请填写库存数量" inputAlign='right' :value="item.stock"
|
||||
@input="onInput($event,item)"></u--input>
|
||||
</view>
|
||||
</view>
|
||||
<u-line direction="row" style="margin: 25rpx 0;" color="#ECECEC"></u-line>
|
||||
|
@ -68,6 +68,11 @@
|
|||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="">
|
||||
<u-button icon="plus" text="新增规格" @click="pushFn" class="custom-style" iconColor='#38BE41'></u-button>
|
||||
</view>
|
||||
|
||||
<view class="submit-btn">
|
||||
<u-button type="primary" shape="circle" text="保存" @click="submit"></u-button>
|
||||
</view>
|
||||
|
@ -176,6 +181,20 @@
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
onInput(event, item) {
|
||||
|
||||
if (!/^\d*$/.test(event)) {
|
||||
event = event.replace(/[^\d]/g, '');
|
||||
}
|
||||
console.log(event);
|
||||
|
||||
item.stock = event;
|
||||
this.$forceUpdate();
|
||||
// 更新整数值
|
||||
},
|
||||
|
||||
|
||||
delFn(index) {
|
||||
if (this.attrValue.length == 1) {
|
||||
return this.$util.Tips({
|
||||
|
@ -327,7 +346,7 @@
|
|||
|
||||
|
||||
.card {
|
||||
margin-top: 30rpx;
|
||||
margin-bottom: 30rpx;
|
||||
padding: 30rpx 46rpx;
|
||||
background-color: white;
|
||||
border-radius: 16rpx 16rpx 16rpx 16rpx;
|
||||
|
|
|
@ -133,7 +133,7 @@
|
|||
|
||||
.left {
|
||||
margin-right: 30rpx;
|
||||
width: 140rpx;
|
||||
width: 160rpx;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
|
|
|
@ -15,12 +15,11 @@
|
|||
{{short.store_name}}
|
||||
</view>
|
||||
<view class="" style="font-size: 24rpx;color: #989898;margin-top: 10rpx;">
|
||||
<!-- 库存: {{short.attrValue[0].stock}}个 -->
|
||||
库存: {{attrvalueStock}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="" style="color: #FC452F;font-size: 24rpx;">
|
||||
<text style="font-size: 22rpx;">¥</text><text>10.00</text><text
|
||||
<text style="font-size: 22rpx;">¥</text><text>{{short.attrValue[0].price}}</text><text
|
||||
style="color: #828282;">/{{short.attrValue && short.attrValue[0].unit_name}}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
@ -30,13 +29,13 @@
|
|||
{{item.sku||'单规格'}}
|
||||
</view>
|
||||
<u-line color="#CECECE" style="margin: 30rpx 0 28rpx 0"></u-line>
|
||||
<view class="" style="display: flex;justify-content: space-between;font-size: 32rpx;">
|
||||
<view class="" style="display: flex;justify-content: space-between;font-size: 32rpx;align-items: center;">
|
||||
<view class="">
|
||||
商品库存
|
||||
</view>
|
||||
<view class="" style="display: flex;align-items: center;color: #FC452F;">
|
||||
<u--input border="surround" color='#FC452F' inputAlign='right' style='padding: 0;'
|
||||
v-model="item.stock"></u--input>个
|
||||
<u--input type="number" border="surround" color='#FC452F' inputAlign='right' style='padding: 0;'
|
||||
:value="item.stock" @input="onInput($event,item)"></u--input>{{item.unit_name}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
@ -110,6 +109,14 @@
|
|||
},
|
||||
onShow() {},
|
||||
methods: {
|
||||
onInput(event, item) {
|
||||
if (!/^\d*$/.test(event)) {
|
||||
event = event.replace(/[^\d]/g, '');
|
||||
}
|
||||
item.stock = event;
|
||||
this.$forceUpdate();
|
||||
// 更新整数值
|
||||
},
|
||||
preViewImg(url) {
|
||||
let that = this
|
||||
uni.previewImage({
|
||||
|
@ -246,6 +253,8 @@
|
|||
position: fixed;
|
||||
bottom: 50rpx;
|
||||
width: 670rpx;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
}
|
||||
|
||||
// old
|
||||
|
|
|
@ -9,7 +9,9 @@
|
|||
// +----------------------------------------------------------------------
|
||||
import app from "./app";
|
||||
import storage from "./storage.js";
|
||||
import permission from "./permission.js";
|
||||
export default {
|
||||
app,
|
||||
storage
|
||||
storage,
|
||||
permission
|
||||
};
|
||||
|
|
|
@ -0,0 +1,250 @@
|
|||
// 权限说明
|
||||
|
||||
const state = {
|
||||
WRITE_EXTERNAL_STORAGE: false,
|
||||
READ_EXTERNAL_STORAGE: false,
|
||||
CAMERA: false,
|
||||
CALL_PHONE: false,
|
||||
ACCESS_FINE_LOCATION: false,
|
||||
/* #ifdef APP-PLUS */
|
||||
isIos: plus.os.name == "iOS",
|
||||
/* #endif */
|
||||
mapping: {
|
||||
'WRITE_EXTERNAL_STORAGE': {
|
||||
title: "存储空间/照片权限说明",
|
||||
content: "便于您使用该功能上传您的照片/图片/视频及用于更换头像、发布评论/分享、下载、与客服沟通等场景中读取和写入相册和文件内容。",
|
||||
methods: 'SET_WRITE_EXTERNAL_STORAGE'
|
||||
},
|
||||
'READ_EXTERNAL_STORAGE': {
|
||||
title: "存储空间/照片权限说明",
|
||||
content: "便于您使用该功能上传您的照片/图片/视频及用于更换头像、发布评论/分享、下载、与客服沟通等场景中读取和写入相册和文件内容。",
|
||||
methods: 'SET_READ_EXTERNAL_STORAGE'
|
||||
},
|
||||
'CAMERA': {
|
||||
title: "相机/存储空间/照片权限说明",
|
||||
content: "便于您使用该功能上传您的照片/图片/视频及用于更换头像、发布评论/分享、下载、扫描二维码、与客服沟通等场景中读取和写入相册和文件内容。",
|
||||
methods: 'SET_CAMERA'
|
||||
},
|
||||
'CALL_PHONE': {
|
||||
title: "拨打/管理电话权限说明",
|
||||
content: "便于您使用该功能联系商家或者商家与您联系等场景",
|
||||
methods: 'SET_CALL_PHONE'
|
||||
},
|
||||
'ACCESS_FINE_LOCATION': {
|
||||
title: "获取位置权限说明",
|
||||
content: "便于您使用该功能查看附近店铺/附近商品/店铺所在位置等场景",
|
||||
methods: 'SET_ACCESS_FINE_LOCATION'
|
||||
}
|
||||
}
|
||||
}
|
||||
const mutations = {
|
||||
SET_WRITE_EXTERNAL_STORAGE(state, val) {
|
||||
state.WRITE_EXTERNAL_STORAGE = val
|
||||
},
|
||||
SET_CALL_PHONE(state, val) {
|
||||
state.CALL_PHONE = val
|
||||
},
|
||||
SET_READ_EXTERNAL_STORAGE(state, val) {
|
||||
state.READ_EXTERNAL_STORAGE = val
|
||||
},
|
||||
SET_CAMERA(state, val) {
|
||||
state.CAMERA = val
|
||||
},
|
||||
SET_ACCESS_FINE_LOCATION(state, val) {
|
||||
state.ACCESS_FINE_LOCATION = val
|
||||
},
|
||||
}
|
||||
const actions = {
|
||||
//权限获取
|
||||
async requestPermissions({
|
||||
state,
|
||||
dispatch,
|
||||
commit
|
||||
}, permissionID) {
|
||||
try {
|
||||
if (!state[permissionID] && !state.isIos) {
|
||||
var viewObj = await dispatch('nativeObjView', permissionID);
|
||||
viewObj.show();
|
||||
}
|
||||
console.log('android.permission.' + permissionID, '当前手机权限');
|
||||
return new Promise(async (resolve, reject) => {
|
||||
//苹果不需要这个
|
||||
if(state.isIos){
|
||||
resolve(1);
|
||||
return
|
||||
}
|
||||
// Android权限查询
|
||||
function requestAndroidPermission(permissionID_) {
|
||||
return new Promise((resolve, reject) => {
|
||||
plus.android.requestPermissions(
|
||||
[
|
||||
permissionID_
|
||||
], // 理论上支持多个权限同时查询,但实际上本函数封装只处理了一个权限的情况。有需要的可自行扩展封装
|
||||
function (resultObj) {
|
||||
var result = 0;
|
||||
for (var i = 0; i < resultObj.granted.length; i++) {
|
||||
var grantedPermission = resultObj.granted[i];
|
||||
console.log('已获取的权限:' + grantedPermission);
|
||||
result = 1
|
||||
}
|
||||
for (var i = 0; i < resultObj.deniedPresent
|
||||
.length; i++) {
|
||||
var deniedPresentPermission = resultObj
|
||||
.deniedPresent[
|
||||
i];
|
||||
console.log('拒绝本次申请的权限:' + deniedPresentPermission);
|
||||
result = 0
|
||||
}
|
||||
for (var i = 0; i < resultObj.deniedAlways
|
||||
.length; i++) {
|
||||
var deniedAlwaysPermission = resultObj.deniedAlways[
|
||||
i];
|
||||
console.log('永久拒绝申请的权限:' + deniedAlwaysPermission);
|
||||
result = -1
|
||||
}
|
||||
resolve(result);
|
||||
},
|
||||
function (error) {
|
||||
console.log('申请权限错误:' + error.code + " = " + error
|
||||
.message);
|
||||
resolve({
|
||||
code: error.code,
|
||||
message: error.message
|
||||
});
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
const result = await requestAndroidPermission(
|
||||
'android.permission.' + permissionID
|
||||
);
|
||||
if (result === 1) {
|
||||
//'已获得授权'
|
||||
commit(state.mapping[permissionID].methods, true)
|
||||
} else if (result === 0) {
|
||||
//'未获得授权'
|
||||
commit(state.mapping[permissionID].methods, false)
|
||||
} else {
|
||||
commit(state.mapping[permissionID].methods, true)
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '操作权限已被拒绝,请手动前往设置',
|
||||
confirmText: "立即设置",
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
dispatch('gotoAppPermissionSetting')
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
if (viewObj) viewObj.close()
|
||||
resolve(result);
|
||||
});
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
new Error(error)
|
||||
// reject(error);
|
||||
}
|
||||
},
|
||||
//提示框
|
||||
nativeObjView({
|
||||
state
|
||||
}, permissionID) {
|
||||
const systemInfo = uni.getSystemInfoSync();
|
||||
const statusBarHeight = systemInfo.statusBarHeight;
|
||||
const navigationBarHeight = systemInfo.platform === 'android' ? 48 :
|
||||
44; // Set the navigation bar height based on the platform
|
||||
const totalHeight = statusBarHeight + navigationBarHeight;
|
||||
let view = new plus.nativeObj.View('per-modal', {
|
||||
top: '0px',
|
||||
left: '0px',
|
||||
width: '100%',
|
||||
backgroundColor: '#444',
|
||||
//opacity: .5;
|
||||
})
|
||||
view.drawRect({
|
||||
color: '#fff',
|
||||
radius: '5px'
|
||||
}, {
|
||||
top: totalHeight + 'px',
|
||||
left: '5%',
|
||||
width: '90%',
|
||||
height: "100px",
|
||||
})
|
||||
view.drawText(state.mapping[permissionID].title, {
|
||||
top: totalHeight + 5 + 'px',
|
||||
left: "8%",
|
||||
height: "30px"
|
||||
}, {
|
||||
align: "left",
|
||||
color: "#000",
|
||||
}, {
|
||||
onClick: function (e) {
|
||||
console.log(e);
|
||||
}
|
||||
})
|
||||
view.drawText(state.mapping[permissionID].content, {
|
||||
top: totalHeight + 35 + 'px',
|
||||
height: "60px",
|
||||
left: "8%",
|
||||
width: "84%"
|
||||
}, {
|
||||
whiteSpace: 'normal',
|
||||
size: "14px",
|
||||
align: "left",
|
||||
color: "#656563"
|
||||
})
|
||||
|
||||
function show() {
|
||||
view = plus.nativeObj.View.getViewById('per-modal');
|
||||
view.show()
|
||||
view = null//展示的时候也得清空,不然影响下次的关闭,不知道为啥
|
||||
}
|
||||
|
||||
function close() {
|
||||
view = plus.nativeObj.View.getViewById('per-modal');
|
||||
view.close();
|
||||
view = null
|
||||
}
|
||||
return {
|
||||
show,
|
||||
close
|
||||
}
|
||||
},
|
||||
|
||||
// 跳转到**应用**的权限页面
|
||||
gotoAppPermissionSetting({
|
||||
state
|
||||
}) {
|
||||
if (state.isIos) {
|
||||
var UIApplication = plus.ios.import("UIApplication");
|
||||
var application2 = UIApplication.sharedApplication();
|
||||
var NSURL2 = plus.ios.import("NSURL");
|
||||
// var setting2 = NSURL2.URLWithString("prefs:root=LOCATION_SERVICES");
|
||||
var setting2 = NSURL2.URLWithString("app-settings:");
|
||||
application2.openURL(setting2);
|
||||
|
||||
plus.ios.deleteObject(setting2);
|
||||
plus.ios.deleteObject(NSURL2);
|
||||
plus.ios.deleteObject(application2);
|
||||
} else {
|
||||
// console.log(plus.device.vendor);
|
||||
var Intent = plus.android.importClass("android.content.Intent");
|
||||
var Settings = plus.android.importClass("android.provider.Settings");
|
||||
var Uri = plus.android.importClass("android.net.Uri");
|
||||
var mainActivity = plus.android.runtimeMainActivity();
|
||||
var intent = new Intent();
|
||||
intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
|
||||
var uri = Uri.fromParts("package", mainActivity.getPackageName(), null);
|
||||
intent.setData(uri);
|
||||
mainActivity.startActivity(intent);
|
||||
}
|
||||
}
|
||||
}
|
||||
export default {
|
||||
namespaced: true,
|
||||
state,
|
||||
mutations,
|
||||
actions
|
||||
};
|
Loading…
Reference in New Issue