tianyi 1 month ago
parent
commit
21d56db0e0
  1. 47
      pages/shop/addGoods.vue
  2. 2
      pages/shop/shopEvaluate.vue
  3. 2
      pages/shop/transferDeliveryOrderList.vue

47
pages/shop/addGoods.vue

@ -32,8 +32,8 @@
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="商品分类" name="editTitle"> <uni-forms-item label="商品分类" name="editTitle">
<view style="border: 4rpx solid #eee;display: flex;flex: 1;border-radius: 10rpx;"> <view style="border: 4rpx solid #eee;display: flex;flex: 1;border-radius: 10rpx;">
<text @click="goGategoryLow" placeholder="请选择商品分类" <input type="text" placeholder="请选择商品分类" disabled v-model="typeItem.categoryName"
class="content-input" style="border: 0;flex: 1;">{{typeItem.categoryName}}</text> class="content-input" @tap="goGategoryLow" style="border: 0;">
<uni-icons type="right" size="16" <uni-icons type="right" size="16"
style="margin-left: 40rpx;line-height: 70rpx;"></uni-icons> style="margin-left: 40rpx;line-height: 70rpx;"></uni-icons>
</view> </view>
@ -117,7 +117,7 @@
<uni-forms-item label="详细图文" name="startPayNum"> <uni-forms-item label="详细图文" name="startPayNum">
<view class="xiangxi-box"> <view class="xiangxi-box">
<sp-editor <sp-editor
:keys="keys"
@init="initEditor" @init="initEditor"
@input="inputOver" @input="inputOver"
@upinImage="upinImage" @upinImage="upinImage"
@ -168,7 +168,7 @@
</template> </template>
<script> <script>
import SpEditor from '@/pages/sp-editor/components/sp-editor/sp-editor.vue' import SpEditor from '@/package2/components/sp-editor/components/sp-editor/sp-editor.vue'
export default { export default {
components: { components: {
@ -239,7 +239,18 @@
onShow() { onShow() {
this.attrId = uni.getStorageSync('attrId'); this.attrId = uni.getStorageSync('attrId');
this.shopMerchantType = uni.getStorageSync('shopMerchantType'); this.shopMerchantType = uni.getStorageSync('shopMerchantType');
uni.authorize({
scope: 'scope.writePhotosAlbum',
success() {
},
fail() {
uni.showToast({
title: "您未授权,图片上传功能可能会出现错误",
icon: 'none'
})
}
})
if (this.hasSelectedTypeItem(this.typeItem)) { if (this.hasSelectedTypeItem(this.typeItem)) {
this.typeItem = JSON.parse(JSON.stringify(this.typeItem)) this.typeItem = JSON.parse(JSON.stringify(this.typeItem))
this.formData.categoryId = this.typeItem.id this.formData.categoryId = this.typeItem.id
@ -374,14 +385,13 @@
}, },
// //
goGategoryLow() { goGategoryLow() {
console.log("111111111111")
uni.navigateTo({ uni.navigateTo({
url: '/pages/shop/addType' url: '/package2/myCenter/addType'
}) })
}, },
// //
getGategoryList() { getGategoryList() {
this.NB.sendRequest("/app/productCategory/list", { this.NB.sendRequest("/auth/getShopByUser", {
shopId:uni.getStorageSync('shopId') shopId:uni.getStorageSync('shopId')
}, false, 'get', 'application/x-www-form-urlencoded').then((res) => { }, false, 'get', 'application/x-www-form-urlencoded').then((res) => {
if (res.code == 200) { if (res.code == 200) {
@ -433,6 +443,7 @@
submit() { submit() {
let that = this; let that = this;
this.syncLunchBoxByMoreBuy() this.syncLunchBoxByMoreBuy()
this.normalizeGroupBuyPrices()
if (!this.validateProductSpecs()) { if (!this.validateProductSpecs()) {
return return
} }
@ -517,7 +528,6 @@
} }
const startPayNum = String(this.formData.startPayNum).trim() const startPayNum = String(this.formData.startPayNum).trim()
if (startPayNum !== '' && !this.isValidInteger(startPayNum)) { if (startPayNum !== '' && !this.isValidInteger(startPayNum)) {
uni.showToast({ uni.showToast({
title: '起售数量只能输入整数', title: '起售数量只能输入整数',
icon: 'none' icon: 'none'
@ -555,6 +565,17 @@
} }
return true return true
}, },
normalizeGroupBuyPrices() {
if (!Array.isArray(this.formData.productGroupBuyPrices)) {
this.formData.productGroupBuyPrices = []
return
}
this.formData.productGroupBuyPrices = this.formData.productGroupBuyPrices.filter((item) => {
const groupCount = item && item.groupCount !== undefined && item.groupCount !== null ? String(item.groupCount).trim() : ''
const groupPrice = item && item.groupPrice !== undefined && item.groupPrice !== null ? String(item.groupPrice).trim() : ''
return groupCount !== '' || groupPrice !== ''
})
},
isValidPrice(value) { isValidPrice(value) {
return /^\d+(\.\d{1,2})?$/.test(value) && Number(value) > 0 return /^\d+(\.\d{1,2})?$/.test(value) && Number(value) > 0
}, },
@ -845,7 +866,9 @@
}, },
getCateGorySon(id){ getCateGorySon(id){
let that = this let that = this
this.NB.sendRequest("/app/productAttributeValue/selectByAttributeId", {}, false, 'get', 'application/x-www-form-urlencoded').then((res) => { this.NB.sendRequest("/app/productAttributeValue/selectByAttributeId", {
id: id,
}, false, 'get', 'application/x-www-form-urlencoded').then((res) => {
if (res.code == 200) { if (res.code == 200) {
that.categorySonData = res.result that.categorySonData = res.result
for (var i = 0; i < that.categorySonData.length; i++) { for (var i = 0; i < that.categorySonData.length; i++) {
@ -918,7 +941,7 @@
goAttributeList(){ goAttributeList(){
this.$refs.addTypeDialog.close() this.$refs.addTypeDialog.close()
uni.navigateTo({ uni.navigateTo({
url: '/pages/shop/attributeList?from=addGoods' url: '/package2/myCenter/attributeList?from=addGoods'
}) })
}, },
async upLoadFile(path) { async upLoadFile(path) {
@ -989,7 +1012,9 @@
} }
.back-btn { .back-btn {
padding-top: 110rpx; position: absolute;
bottom: 0;
left: 0;
} }
.title-name { .title-name {

2
pages/shop/shopEvaluate.vue

@ -361,7 +361,7 @@
let that = this; let that = this;
let hiver_token = uni.getStorageSync("hiver_token") let hiver_token = uni.getStorageSync("hiver_token")
await uni.uploadFile({ await uni.uploadFile({
url: that.tui.interfaceUrl() + '/upload/file', url: getApp().globalData.mainurl + '/upload/file',
filePath: path, filePath: path,
name: 'file', name: 'file',
header: { header: {

2
pages/shop/transferDeliveryOrderList.vue

@ -205,7 +205,7 @@
}, },
uploadImage(index, filePath) { uploadImage(index, filePath) {
uni.uploadFile({ uni.uploadFile({
url: this.tui.interfaceUrl() + '/upload/file', url: getApp().globalData.mainurl + '/upload/file',
filePath, filePath,
name: 'file', name: 'file',
header: { header: {

Loading…
Cancel
Save